W3cubDocs

/Drupal 8

public function CacheCollector::get

public CacheCollector::get($key)

Gets value from the cache.

Parameters

string $key: Key that identifies the data.

Return value

mixed The corresponding cache data.

Overrides CacheCollectorInterface::get

File

core/lib/Drupal/Core/Cache/CacheCollector.php, line 142

Class

CacheCollector
Default implementation for CacheCollectorInterface.

Namespace

Drupal\Core\Cache

Code

public function get($key) {
  $this->lazyLoadCache();
  if (isset($this->storage[$key]) || array_key_exists($key, $this->storage)) {
    return $this->storage[$key];
  }
  else {
    return $this->resolveCacheMiss($key);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Cache!CacheCollector.php/function/CacheCollector::get/8.1.x