NullStateStore

Dummy state store implementation that doesn’t do anything.

Implements: IStateStore

Description

It can be used in testing or in situations when state management is not required but shall be disabled.

Instance methods

delete

Deletes a state from the store by its key.

public delete<T>(context: IContext, key: string): Promise<T>

  • context: IContext - (optional) a context to trace execution through call chain.
  • key: string - a unique value key.
  • return: Promise<T> - removed item

load

Loads state from the store using its key. If value is missing in the store it returns null.

public load<T>(context: IContext, key: string): Promise<T>

  • context: IContext - (optional) a context to trace execution through call chain.
  • key: string - a unique state key.
  • return: Promise<T> - the state value or null if value wasn’t found.

loadBulk

Loads an array of states from the store using their keys.

public loadBulk<T>(context: IContext, keys: string[]): Promise<StateValue<T>[]>

  • context: IContext - (optional) a context to trace execution through call chain.
  • keys: string[] - unique state keys.
  • returns: Promise<StateValue<T>[]> - an array with state values and their corresponding keys.

save

Saves state into the store.

public save<T>(context: IContext, key: string, value: any): Promise<T>

  • context: IContext - (optional) a context to trace execution through call chain.
  • key: string - a unique state key.
  • value: any - a state value.
  • returns: Promise<T> - execution duration in milliseconds.

See also