public function ChainedFastBackendFactory::get in Supercache 2.0.x
Same name and namespace in other branches
- 8 src/Cache/ChainedFastBackendFactory.php \Drupal\supercache\Cache\ChainedFastBackendFactory::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
\Drupal\Core\Cache\CacheBackendInterface The cache backend object associated with the specified bin.
Overrides CacheFactoryInterface::get
File
- src/
Cache/ ChainedFastBackendFactory.php, line 96 - Contains \Drupal\supercache\Cache\ChainedFastBackendFactory.
Class
- ChainedFastBackendFactory
- Defines the chained fast cache backend factory.
Namespace
Drupal\supercache\CacheCode
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)) {
if (!isset($this->caches[$bin])) {
$this->caches[$bin] = new ChainedFastBackend($this->container
->get($this->consistentServiceName)
->get($bin), $this->container
->get($this->fastServiceName)
->get($bin), $bin, !$this->kernel_terminated);
}
return $this->caches[$bin];
}
else {
return $this->container
->get($this->consistentServiceName)
->get($bin);
}
}