Mercurial > hg > isophonics-drupal-site
annotate core/lib/Drupal/Core/State/StateInterface.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\Core\State; |
Chris@0 | 4 |
Chris@0 | 5 /** |
Chris@0 | 6 * Defines the interface for the state system. |
Chris@0 | 7 * |
Chris@0 | 8 * @ingroup state_api |
Chris@0 | 9 */ |
Chris@0 | 10 interface StateInterface { |
Chris@0 | 11 |
Chris@0 | 12 /** |
Chris@0 | 13 * Returns the stored value for a given key. |
Chris@0 | 14 * |
Chris@0 | 15 * @param string $key |
Chris@0 | 16 * The key of the data to retrieve. |
Chris@0 | 17 * @param mixed $default |
Chris@0 | 18 * The default value to use if the key is not found. |
Chris@0 | 19 * |
Chris@0 | 20 * @return mixed |
Chris@0 | 21 * The stored value, or NULL if no value exists. |
Chris@0 | 22 */ |
Chris@0 | 23 public function get($key, $default = NULL); |
Chris@0 | 24 |
Chris@0 | 25 /** |
Chris@0 | 26 * Returns the stored key/value pairs for a given set of keys. |
Chris@0 | 27 * |
Chris@0 | 28 * @param array $keys |
Chris@0 | 29 * A list of keys to retrieve. |
Chris@0 | 30 * |
Chris@0 | 31 * @return array |
Chris@0 | 32 * An associative array of items successfully returned, indexed by key. |
Chris@0 | 33 */ |
Chris@0 | 34 public function getMultiple(array $keys); |
Chris@0 | 35 |
Chris@0 | 36 /** |
Chris@0 | 37 * Saves a value for a given key. |
Chris@0 | 38 * |
Chris@0 | 39 * @param string $key |
Chris@0 | 40 * The key of the data to store. |
Chris@0 | 41 * @param mixed $value |
Chris@0 | 42 * The data to store. |
Chris@0 | 43 */ |
Chris@0 | 44 public function set($key, $value); |
Chris@0 | 45 |
Chris@0 | 46 /** |
Chris@0 | 47 * Saves key/value pairs. |
Chris@0 | 48 * |
Chris@0 | 49 * @param array $data |
Chris@0 | 50 * An associative array of key/value pairs. |
Chris@0 | 51 */ |
Chris@0 | 52 public function setMultiple(array $data); |
Chris@0 | 53 |
Chris@0 | 54 /** |
Chris@0 | 55 * Deletes an item. |
Chris@0 | 56 * |
Chris@0 | 57 * @param string $key |
Chris@0 | 58 * The item name to delete. |
Chris@0 | 59 */ |
Chris@0 | 60 public function delete($key); |
Chris@0 | 61 |
Chris@0 | 62 /** |
Chris@0 | 63 * Deletes multiple items. |
Chris@0 | 64 * |
Chris@0 | 65 * @param array $keys |
Chris@0 | 66 * A list of item names to delete. |
Chris@0 | 67 */ |
Chris@0 | 68 public function deleteMultiple(array $keys); |
Chris@0 | 69 |
Chris@0 | 70 /** |
Chris@0 | 71 * Resets the static cache. |
Chris@0 | 72 * |
Chris@0 | 73 * This is mainly used in testing environments. |
Chris@0 | 74 */ |
Chris@0 | 75 public function resetCache(); |
Chris@0 | 76 |
Chris@0 | 77 } |