class UpdateCacheBackendFactory in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Update/UpdateCacheBackendFactory.php \Drupal\Core\Update\UpdateCacheBackendFactory
Cache factory implementation for use during Drupal database updates.
Decorates the regular runtime cache_factory service so that caches use \Drupal\Core\Update\UpdateBackend.
Hierarchy
- class \Drupal\Core\Update\UpdateCacheBackendFactory implements CacheFactoryInterface
Expanded class hierarchy of UpdateCacheBackendFactory
See also
\Drupal\Core\Update\UpdateServiceProvider::register()
File
- core/
lib/ Drupal/ Core/ Update/ UpdateCacheBackendFactory.php, line 15
Namespace
Drupal\Core\UpdateView source
class UpdateCacheBackendFactory implements CacheFactoryInterface {
/**
* The regular runtime cache_factory service.
*
* @var \Drupal\Core\Cache\CacheFactoryInterface
*/
protected $cacheFactory;
/**
* Instantiated update cache bins.
*
* @var \Drupal\Core\Update\UpdateBackend[]
*/
protected $bins = [];
/**
* UpdateCacheBackendFactory constructor.
*
* @param \Drupal\Core\Cache\CacheFactoryInterface $cache_factory
* The regular runtime cache_factory service.
*/
public function __construct(CacheFactoryInterface $cache_factory) {
$this->cacheFactory = $cache_factory;
}
/**
* {@inheritdoc}
*/
public function get($bin) {
if (!isset($this->bins[$bin])) {
$this->bins[$bin] = new UpdateBackend($this->cacheFactory
->get($bin), $bin);
}
return $this->bins[$bin];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UpdateCacheBackendFactory:: |
protected | property | Instantiated update cache bins. | |
UpdateCacheBackendFactory:: |
protected | property | The regular runtime cache_factory service. | |
UpdateCacheBackendFactory:: |
public | function |
Gets a cache backend class for a given cache bin. Overrides CacheFactoryInterface:: |
|
UpdateCacheBackendFactory:: |
public | function | UpdateCacheBackendFactory constructor. |