class CacheFactoryWrapper in Devel 4.x
Same name and namespace in other branches
- 8.3 webprofiler/src/Cache/CacheFactoryWrapper.php \Drupal\webprofiler\Cache\CacheFactoryWrapper
- 8 webprofiler/src/Cache/CacheFactoryWrapper.php \Drupal\webprofiler\Cache\CacheFactoryWrapper
- 8.2 webprofiler/src/Cache/CacheFactoryWrapper.php \Drupal\webprofiler\Cache\CacheFactoryWrapper
Wraps a cache factory to register all calls to the cache system.
Hierarchy
- class \Drupal\webprofiler\Cache\CacheFactoryWrapper implements \Symfony\Component\DependencyInjection\ContainerAwareInterface, CacheFactoryInterface uses \Symfony\Component\DependencyInjection\ContainerAwareTrait
Expanded class hierarchy of CacheFactoryWrapper
1 string reference to 'CacheFactoryWrapper'
- webprofiler.services.yml in webprofiler/
webprofiler.services.yml - webprofiler/webprofiler.services.yml
1 service uses CacheFactoryWrapper
File
- webprofiler/
src/ Cache/ CacheFactoryWrapper.php, line 13
Namespace
Drupal\webprofiler\CacheView source
class CacheFactoryWrapper implements CacheFactoryInterface, ContainerAwareInterface {
use ContainerAwareTrait;
/**
* The cache factory.
*
* @var \Drupal\Core\Cache\CacheFactoryInterface
*/
protected $cacheFactory;
/**
* The cache data collector.
*
* @var \Drupal\webprofiler\DataCollector\CacheDataCollector
*/
protected $cacheDataCollector;
/**
* All wrapped cache backends.
*
* @var \Drupal\webprofiler\Cache\CacheBackendWrapper[]
*/
protected $cacheBackends = [];
/**
* Creates a new CacheFactoryWrapper instance.
*
* @param \Drupal\Core\Cache\CacheFactoryInterface $cache_factory
* The cache factory.
* @param \Drupal\webprofiler\DataCollector\CacheDataCollector $cacheDataCollector
* The cache data collector.
*/
public function __construct(CacheFactoryInterface $cache_factory, CacheDataCollector $cacheDataCollector) {
$this->cacheFactory = $cache_factory;
$this->cacheDataCollector = $cacheDataCollector;
}
/**
* {@inheritdoc}
*/
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];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheFactoryWrapper:: |
protected | property | All wrapped cache backends. | |
CacheFactoryWrapper:: |
protected | property | The cache data collector. | |
CacheFactoryWrapper:: |
protected | property | The cache factory. | |
CacheFactoryWrapper:: |
public | function |
Gets a cache backend class for a given cache bin. Overrides CacheFactoryInterface:: |
|
CacheFactoryWrapper:: |
public | function | Creates a new CacheFactoryWrapper instance. |