You are here

public function CacheFactoryWrapper::get in Devel 8

Same name and namespace in other branches
  1. 8.3 webprofiler/src/Cache/CacheFactoryWrapper.php \Drupal\webprofiler\Cache\CacheFactoryWrapper::get()
  2. 8.2 webprofiler/src/Cache/CacheFactoryWrapper.php \Drupal\webprofiler\Cache\CacheFactoryWrapper::get()
  3. 4.x webprofiler/src/Cache/CacheFactoryWrapper.php \Drupal\webprofiler\Cache\CacheFactoryWrapper::get()

Gets a cache backend class for a given cache bin.

Parameters

string $bin: The cache bin for which a cache backend object should be returned.

Return value

\Drupal\Core\Cache\CacheBackendInterface The cache backend object associated with the specified bin.

Overrides CacheFactoryInterface::get

File

webprofiler/src/Cache/CacheFactoryWrapper.php, line 54

Class

CacheFactoryWrapper
Wraps a cache factory to register all calls to the cache system.

Namespace

Drupal\webprofiler\Cache

Code

public function get($bin) {
  if (!isset($this->cacheBackends[$bin])) {
    $cache_backend = $this->cacheFactory
      ->get($bin);
    $this->cacheBackends[$bin] = new CacheBackendWrapper($this->cacheDataCollector, $cache_backend, $bin);
  }
  return $this->cacheBackends[$bin];
}