function CacheCollector::get

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

Overrides CacheCollectorInterface::get

5 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.
State::get in core/lib/Drupal/Core/State/State.php
Gets value from the cache.
3 methods override CacheCollector::get()
AliasWhitelist::get in core/modules/path_alias/src/AliasWhitelist.php
Gets value from the cache.
State::get in core/lib/Drupal/Core/State/State.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 142

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);
    }
}

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