Class MemoryStateStore
java.lang.Object
org.pipservices3.components.state.MemoryStateStore
- All Implemented Interfaces:
org.pipservices3.commons.config.IConfigurable,org.pipservices3.commons.config.IReconfigurable,IStateStore
public class MemoryStateStore
extends Object
implements IStateStore, org.pipservices3.commons.config.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)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(org.pipservices3.commons.config.ConfigParams configParams) Configures component by passing configuration parameters.<T> TDeletes a state from the store by its key.<T> TLoads state from the store using its key.<T> List<StateValue<T>>Loads an array of states from the store using their keys.<T> TSaves state into the store
-
Constructor Details
-
MemoryStateStore
public MemoryStateStore()
-
-
Method Details
-
configure
public void configure(org.pipservices3.commons.config.ConfigParams configParams) throws org.pipservices3.commons.errors.ConfigException Configures component by passing configuration parameters.- Specified by:
configurein interfaceorg.pipservices3.commons.config.IConfigurable- Parameters:
configParams- configuration parameters to be set.- Throws:
org.pipservices3.commons.errors.ConfigException
-
load
Loads state from the store using its key. If value is missing in the store it returns null.- Specified by:
loadin interfaceIStateStore- Type Parameters:
T-- Parameters:
correlationId- (optional) transaction id to trace execution through call chain.key- a unique state key.- Returns:
- the state value or
nullif value wasn't found.
-
loadBulk
Loads an array of states from the store using their keys.- Specified by:
loadBulkin interfaceIStateStore- Type Parameters:
T-- Parameters:
correlationId- (optional) transaction id to trace execution through call chain.keys- unique state keys.- Returns:
- an array with state values.
-
save
Saves state into the store- Specified by:
savein interfaceIStateStore- 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 value that was stored in the cache.
-
delete
Deletes a state from the store by its key.- Specified by:
deletein interfaceIStateStore- Type Parameters:
T-- Parameters:
correlationId- (optional) transaction id to trace execution through call chain.key- a unique value key.- Returns:
- deleted item
-