You are here

public function ChainedFastRawBackendFactory::get in Supercache 8

Same name and namespace in other branches
  1. 2.0.x src/Cache/ChainedFastRawBackendFactory.php \Drupal\supercache\Cache\ChainedFastRawBackendFactory::get()

Instantiates a chained, fast 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

CacheRawBackendInterface The cache backend object associated with the specified bin.

Overrides CacheRawFactoryInterface::get

File

src/Cache/ChainedFastRawBackendFactory.php, line 98
Contains \Drupal\supercache\Cache\ChainedFastBackendFactory.

Class

ChainedFastRawBackendFactory
Defines the chained fast cache backend factory.

Namespace

Drupal\supercache\Cache

Code

public function get($bin) {

  // Use the chained backend only if there is a fast backend available;
  // otherwise, just return the consistent backend directly.
  if (isset($this->fastServiceName)) {
    return new ChainedFastRawBackend($this->container
      ->get($this->consistentServiceName)
      ->get($bin), $this->container
      ->get($this->fastServiceName)
      ->get($bin), !$this->kernel_terminated);
  }
  else {
    return $this->container
      ->get($this->consistentServiceName)
      ->get($bin);
  }
}