function CacheCollector::get

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

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/lib/Drupal/Core/Path/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 (isset($this->storage[$key]) || 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.