function CacheCollector::get

Same name 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

6 calls to CacheCollector::get()
CacheCollector::has in core/lib/Drupal/Core/Cache/CacheCollector.php
LibraryDiscoveryCollector::applyLibrariesExtend in core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php
Applies the libraries-extend specified by the active theme.
LibraryDiscoveryCollector::getLibrariesByExtension in core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php
Gets all libraries defined by an extension.
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.

... See full list

3 methods override CacheCollector::get()
AliasPrefixList::get in core/modules/path_alias/src/AliasPrefixList.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.