class BackendChain

Defines a chained cache implementation for combining multiple cache backends.

Can be used to combine two or more backends together to behave as if they were a single backend.

For example a slower, persistent storage engine could be combined with a faster, volatile storage engine. When retrieving items from cache, they will be fetched from the volatile backend first, only falling back to the persistent backend if an item is not available. An item not present in the volatile backend but found in the persistent one will be propagated back up to ensure fast retrieval on the next request. On cache sets and deletes, both backends will be invoked to ensure consistency.

Hierarchy

Expanded class hierarchy of BackendChain

2 files declare their use of BackendChain

File

drupal/core/lib/Drupal/Core/Cache/BackendChain.php, line 24
Definition of Drupal\Core\Cache\BackendChain.

Namespace

Drupal\Core\Cache
View source

Members

Namesort descending Modifiers Type Description Overrides
BackendChain::$backends protected property Ordered list of CacheBackendInterface instances.
BackendChain::appendBackend public function Appends a cache backend to the cache chain.
BackendChain::delete public function Implements Drupal\Core\Cache\CacheBackendInterface::delete(). Overrides CacheBackendInterface::delete
BackendChain::deleteAll public function Implements Drupal\Core\Cache\CacheBackendInterface::deleteAll(). Overrides CacheBackendInterface::deleteAll
BackendChain::deleteExpired public function Implements Drupal\Core\Cache\CacheBackendInterface::expire(). Overrides CacheBackendInterface::deleteExpired
BackendChain::deleteMultiple public function Implements Drupal\Core\Cache\CacheBackendInterface::deleteMultiple(). Overrides CacheBackendInterface::deleteMultiple
BackendChain::deleteTags public function Implements Drupal\Core\Cache\CacheBackendInterface::deleteTags(). Overrides CacheBackendInterface::deleteTags
BackendChain::garbageCollection public function Implements Drupal\Core\Cache\CacheBackendInterface::garbageCollection(). Overrides CacheBackendInterface::garbageCollection
BackendChain::get public function Implements Drupal\Core\Cache\CacheBackendInterface::get(). Overrides CacheBackendInterface::get
BackendChain::getMultiple public function Implements Drupal\Core\Cache\CacheBackendInterface::getMultiple(). Overrides CacheBackendInterface::getMultiple
BackendChain::invalidate public function Implements Drupal\Core\Cache\CacheBackendInterface::invalidate(). Overrides CacheBackendInterface::invalidate
BackendChain::invalidateAll public function Implements Drupal\Core\Cache\CacheBackendInterface::invalidateAll(). Overrides CacheBackendInterface::invalidateAll
BackendChain::invalidateMultiple public function Implements Drupal\Core\Cache\CacheBackendInterface::invalidateMultiple(). Overrides CacheBackendInterface::invalidateMultiple
BackendChain::invalidateTags public function Implements Drupal\Core\Cache\CacheBackendInterface::invalidateTags(). Overrides CacheBackendInterface::invalidateTags
BackendChain::isEmpty public function Implements Drupal\Core\Cache\CacheBackendInterface::isEmpty(). Overrides CacheBackendInterface::isEmpty
BackendChain::prependBackend public function Prepends a cache backend to the cache chain.
BackendChain::set public function Implements Drupal\Core\Cache\CacheBackendInterface::set(). Overrides CacheBackendInterface::set
BackendChain::__construct public function Constructs a DatabaseBackend object.
CacheBackendInterface::CACHE_PERMANENT constant Indicates that the item should never be removed unless explicitly deleted.