3 namespace Drupal\Core\State;
6 * Defines the interface for the state system.
10 interface StateInterface {
13 * Returns the stored value for a given key.
16 * The key of the data to retrieve.
17 * @param mixed $default
18 * The default value to use if the key is not found.
21 * The stored value, or NULL if no value exists.
23 public function get($key, $default = NULL);
26 * Returns the stored key/value pairs for a given set of keys.
29 * A list of keys to retrieve.
32 * An associative array of items successfully returned, indexed by key.
34 public function getMultiple(array $keys);
37 * Saves a value for a given key.
40 * The key of the data to store.
44 public function set($key, $value);
47 * Saves key/value pairs.
50 * An associative array of key/value pairs.
52 public function setMultiple(array $data);
58 * The item name to delete.
60 public function delete($key);
63 * Deletes multiple items.
66 * A list of item names to delete.
68 public function deleteMultiple(array $keys);
71 * Resets the static cache.
73 * This is mainly used in testing environments.
75 public function resetCache();