Package io.dapr.actors.runtime

# Class ActorStateManager

java.lang.Object
io.dapr.actors.runtime.ActorStateManager

    public class ActorStateManager
    extends java.lang.Object

Manages state changes of a given Actor instance. All changes are cached in-memory until save() is called.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `<T> reactor.core.publisher.Mono<java.lang.Void>` | `add​(java.lang.String stateName, T value)` | Adds a given key/value to the Actor's state store's cache.
  `void` | `clear()` | Clears all changes not yet saved to state store.
  `reactor.core.publisher.Mono<java.lang.Boolean>` | `contains​(java.lang.String stateName)` | Checks if a given state exists in state store or cache.
  `<T> reactor.core.publisher.Mono<T>` | `get​(java.lang.String stateName, TypeRef<T> type)` | Fetches the most recent value for the given state, including cached value.
  `<T> reactor.core.publisher.Mono<T>` | `get​(java.lang.String stateName, java.lang.Class<T> clazz)` | Fetches the most recent value for the given state, including cached value.
  `reactor.core.publisher.Mono<java.lang.Void>` | `remove​(java.lang.String stateName)` | Removes a given state from state store's cache.
  `reactor.core.publisher.Mono<java.lang.Void>` | `save()` | Saves all changes to state store.
  `<T> reactor.core.publisher.Mono<java.lang.Void>` | `set​(java.lang.String stateName, T value)` | Updates a given key/value pair in the state store's cache.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### add

    public <T> reactor.core.publisher.Mono<java.lang.Void> add​(java.lang.String stateName, T value)
    Adds a given key/value to the Actor's state store's cache.
    Type Parameters:
      `T` - Type of the object being added.
    Parameters:
      `stateName` - Name of the state being added.
      `value` - Value to be added.
    Returns:
      Asynchronous void operation.

  - ### get

    public <T> reactor.core.publisher.Mono<T> get​(java.lang.String stateName, java.lang.Class<T> clazz)
    Fetches the most recent value for the given state, including cached value.
    Type Parameters:
      `T` - Type being fetched.
    Parameters:
      `stateName` - Name of the state.
      `clazz` - Class type for the value being fetched.
    Returns:
      Asynchronous response with fetched object.

  - ### get

    public <T> reactor.core.publisher.Mono<T> get​(java.lang.String stateName, TypeRef<T> type)
    Fetches the most recent value for the given state, including cached value.
    Type Parameters:
      `T` - Type being fetched.
    Parameters:
      `stateName` - Name of the state.
      `type` - Class type for the value being fetched.
    Returns:
      Asynchronous response with fetched object.

  - ### set

    public <T> reactor.core.publisher.Mono<java.lang.Void> set​(java.lang.String stateName, T value)
    Updates a given key/value pair in the state store's cache.
    Type Parameters:
      `T` - Type of the value being set.
    Parameters:
      `stateName` - Name of the state being updated.
      `value` - Value to be set for given state.
    Returns:
      Asynchronous void result.

  - ### remove

    public reactor.core.publisher.Mono<java.lang.Void> remove​(java.lang.String stateName)
    Removes a given state from state store's cache.
    Parameters:
      `stateName` - State being stored.
    Returns:
      Asynchronous void result.

  - ### contains

    public reactor.core.publisher.Mono<java.lang.Boolean> contains​(java.lang.String stateName)
    Checks if a given state exists in state store or cache.
    Parameters:
      `stateName` - State being checked.
    Returns:
      Asynchronous boolean result indicating whether state is present.

  - ### save

    public reactor.core.publisher.Mono<java.lang.Void> save()
    Saves all changes to state store.
    Returns:
      Asynchronous void result.

  - ### clear

    public void clear()
    Clears all changes not yet saved to state store.