Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Cache/CacheCollector.php \Drupal\Core\Cache\CacheCollector::get()
  2. 9 core/lib/Drupal/Core/Cache/CacheCollector.php \Drupal\Core\Cache\CacheCollector::get()

Gets value from the cache.

Parameters

string $key: Key that identifies the data.

Return value

mixed The corresponding cache data.

Overrides CacheCollectorInterface::get

4 calls to CacheCollector::get()
CacheCollector::has in core/lib/Drupal/Core/Cache/CacheCollector.php
Returns whether data exists for this key.
LibraryDiscoveryCollector::applyLibrariesExtend in core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php
Applies the libraries-extend specified by the active theme.
LibraryDiscoveryCollector::getLibraryDefinitions in core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php
Returns the library definitions for a given extension.
MenuActiveTrail::getActiveTrailIds in core/lib/Drupal/Core/Menu/MenuActiveTrail.php
This implementation caches all active trail IDs per route match for *all* menus whose active trails are calculated on that page. This ensures 1 cache get for all active trails per page load, rather than N.
2 methods override CacheCollector::get()
AliasWhitelist::get in core/modules/path_alias/src/AliasWhitelist.php
Gets value from the cache.
ThemeRegistry::get in core/lib/Drupal/Core/Utility/ThemeRegistry.php
Gets value from the cache.

File

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

Class

CacheCollector
Default implementation for CacheCollectorInterface.

Namespace

Drupal\Core\Cache

Code

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