function CacheFactoryDecorator::get

Same name in other branches
  1. 10 core/modules/system/tests/modules/performance_test/src/Cache/CacheFactoryDecorator.php \Drupal\performance_test\Cache\CacheFactoryDecorator::get()

Overrides CacheFactoryInterface::get

File

core/modules/system/tests/modules/performance_test/src/Cache/CacheFactoryDecorator.php, line 30

Class

CacheFactoryDecorator
Decorates a cache factory to register all calls to the cache system.

Namespace

Drupal\performance_test\Cache

Code

public function get($bin) : CacheBackendInterface {
    if (!isset($this->cacheBackends[$bin])) {
        $cache_backend = $this->cacheFactory
            ->get($bin);
        // Don't log memory cache operations.
        if (!$cache_backend instanceof MemoryCacheInterface && !$cache_backend instanceof MemoryBackend) {
            $this->cacheBackends[$bin] = new CacheBackendDecorator($this->performanceDataCollector, $cache_backend, $bin);
        }
        else {
            $this->cacheBackends[$bin] = $cache_backend;
        }
    }
    return $this->cacheBackends[$bin];
}

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