State
class State implements StateInterface (View source)
Provides the state system using a key value store.
Properties
| protected KeyValueStoreInterface | $keyValueStore | The key value store to use. |
|
| protected array | $cache | Static state cache. |
Methods
mixed
get(string $key, mixed $default = NULL)
Returns the stored value for a given key.
array
getMultiple(array $keys)
Returns the stored key/value pairs for a given set of keys.
set(string $key, mixed $value)
Saves a value for a given key.
setMultiple(array $data)
Saves key/value pairs.
delete(string $key)
Deletes an item.
deleteMultiple(array $keys)
Deletes multiple items.
resetCache()
Resets the static cache.
Details
__construct(KeyValueFactoryInterface $key_value_factory)
Constructs a State object.
mixed
get(string $key, mixed $default = NULL)
Returns the stored value for a given key.
array
getMultiple(array $keys)
Returns the stored key/value pairs for a given set of keys.
set(string $key, mixed $value)
Saves a value for a given key.
setMultiple(array $data)
Saves key/value pairs.
delete(string $key)
Deletes an item.
deleteMultiple(array $keys)
Deletes multiple items.
resetCache()
Resets the static cache.
This is mainly used in testing environments.