diff --git a/core/lib/Drupal/Core/KeyValueStore/State.php b/core/lib/Drupal/Core/KeyValueStore/State.php index 36a7973..9a7d7aa 100644 --- a/core/lib/Drupal/Core/KeyValueStore/State.php +++ b/core/lib/Drupal/Core/KeyValueStore/State.php @@ -39,6 +39,14 @@ function __construct(KeyValueFactory $key_value_factory) { /** * {@inheritdoc} */ + public function get($key, $default = NULL) { + $values = $this->getMultiple(array($key)); + return isset($values[$key]) ? $values[$key] : $default; + } + + /** + * {@inheritdoc} + */ public function getMultiple(array $keys) { $values = array(); $load = array(); @@ -82,25 +90,6 @@ public function set($key, $value) { /** * {@inheritdoc} */ - public function deleteMultiple(array $keys) { - foreach ($keys as $key) { - unset($this->cache[$key]); - } - $this->keyValueStore->deleteMultiple($keys); - } - - - /** - * {@inheritdoc} - */ - public function get($key, $default = NULL) { - $values = $this->getMultiple(array($key)); - return isset($values[$key]) ? $values[$key] : $default; - } - - /** - * {@inheritdoc} - */ public function setMultiple(array $data) { foreach ($data as $key => $value) { $this->cache[$key] = $value; @@ -118,6 +107,16 @@ public function delete($key) { /** * {@inheritdoc} */ + public function deleteMultiple(array $keys) { + foreach ($keys as $key) { + unset($this->cache[$key]); + } + $this->keyValueStore->deleteMultiple($keys); + } + + /** + * {@inheritdoc} + */ public function resetCache() { $this->cache = array(); } diff --git a/core/lib/Drupal/Core/KeyValueStore/StateInterface.php b/core/lib/Drupal/Core/KeyValueStore/StateInterface.php index 7584abc..f5f3da6 100644 --- a/core/lib/Drupal/Core/KeyValueStore/StateInterface.php +++ b/core/lib/Drupal/Core/KeyValueStore/StateInterface.php @@ -73,7 +73,7 @@ public function deleteMultiple(array $keys); /** * Resets the static cache. * - * This is only needed for Simpletest. + * This is mainly used in testing environments. */ public function resetCache();