pip_services3_components.state.MemoryStateStore module
-
class
pip_services3_components.state.MemoryStateStore.
MemoryStateStore
Bases:
pip_services3_components.state.IStateStore.IStateStore
,pip_services3_commons.config.IReconfigurable.IReconfigurable
State store that keeps states in the process memory.
Remember: This implementation is not suitable for synchronization of distributed processes.
### Configuration parameters ###
__options:__ - timeout: default caching timeout in milliseconds (default: disabled)
See:
ICache
Example:
store = MemoryStateStore() value = store.load("123", "key1") ... store.save("123", "key1", "ABC")
-
configure
(config: pip_services3_commons.config.ConfigParams.ConfigParams) Configures component by passing configuration parameters.
- Parameters
config – configuration parameters to be set.
-
delete
(correlation_id: Optional[str], key: str) → Any Deletes a state from the store by its key.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
key – a unique state key.
- Returns
deleted item
-
load
(correlation_id: Optional[str], key: str) → Any Loads stored value from the store using its key. If value is missing in the store it returns None.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
key – a unique state key.
- Returns
the state value or None if value wasn’t found.
-
load_bulk
(correlation_id: Optional[str], keys: List[str]) → List[pip_services3_components.state.StateValue.StateValue] Loads an array of states from the store using their keys.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
keys – unique state keys.
- Returns
an array with state values.
-