Class NullStateStore

java.lang.Object
org.pipservices3.components.state.NullStateStore
All Implemented Interfaces:
IStateStore

public class NullStateStore extends Object implements IStateStore
Dummy state store implementation that doesn't do anything. It can be used in testing or in situations when state management is not required but shall be disabled.
  • Constructor Details

    • NullStateStore

      public NullStateStore()
  • Method Details

    • load

      public <T> T load(String correlationId, String key)
      Loads state from the store using its key. If value is missing in the stored it returns null.
      Specified by:
      load in interface IStateStore
      Type Parameters:
      T -
      Parameters:
      correlationId - (optional) transaction id to trace execution through call chain.
      key - a unique state key.
      Returns:
      the state value or null if value wasn't found.
    • loadBulk

      public <T> List<StateValue<T>> loadBulk(String correlationId, List<String> keys)
      Loads an array of states from the store using their keys.
      Specified by:
      loadBulk in interface IStateStore
      Type Parameters:
      T -
      Parameters:
      correlationId - (optional) transaction id to trace execution through call chain.
      keys - unique state keys.
      Returns:
      an array with state values and their corresponding keys.
    • save

      public <T> T save(String correlationId, String key, T value)
      Saves state into the store.
      Specified by:
      save in interface IStateStore
      Type Parameters:
      T -
      Parameters:
      correlationId - (optional) transaction id to trace execution through call chain.
      key - a unique state key.
      value - a state value.
      Returns:
      The state that was stored in the store.
    • delete

      public <T> T delete(String correlationId, String key)
      Deletes a state from the store by its key.
      Specified by:
      delete in interface IStateStore
      Type Parameters:
      T -
      Parameters:
      correlationId - (optional) transaction id to trace execution through call chain.
      key - a unique value key.
      Returns:
      deleted value