function State::resolveCacheMiss

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/State/State.php \Drupal\Core\State\State::resolveCacheMiss()

Resolves a cache miss.

When an offset is not found in the object, this is treated as a cache miss. This method allows classes using this implementation to look up the actual value and allow it to be cached.

Parameters

string $key: The offset that was requested.

Return value

mixed The value of the offset, or NULL if no value was found.

Overrides CacheCollector::resolveCacheMiss

File

core/lib/Drupal/Core/State/State.php, line 86

Class

State
Provides the state system using a key value store.

Namespace

Drupal\Core\State

Code

protected function resolveCacheMiss($key) {
    $value = $this->keyValueStore
        ->get($key);
    $this->storage[$key] = $value;
    $this->persist($key);
    return $value;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.