W3cubDocs

/Drupal 8

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

See also

\Drupal\Core\Cache\ChainedFastBackend

Related topics

Cache API
Information about the Drupal Cache API

File

core/lib/Drupal/Core/Cache/BackendChain.php, line 22

Namespace

Drupal\Core\Cache

Members

Name Modifiers Type Description
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 Deletes an item from the cache. Overrides CacheBackendInterface::delete
BackendChain::deleteAll public function Deletes all cache items in a bin. Overrides CacheBackendInterface::deleteAll
BackendChain::deleteMultiple public function Deletes multiple items from the cache. Overrides CacheBackendInterface::deleteMultiple
BackendChain::garbageCollection public function Performs garbage collection on a cache bin. Overrides CacheBackendInterface::garbageCollection
BackendChain::get public function Returns data from the persistent cache. Overrides CacheBackendInterface::get
BackendChain::getMultiple public function Returns data from the persistent cache when given an array of cache IDs. Overrides CacheBackendInterface::getMultiple
BackendChain::invalidate public function Marks a cache item as invalid. Overrides CacheBackendInterface::invalidate
BackendChain::invalidateAll public function Marks all cache items as invalid. Overrides CacheBackendInterface::invalidateAll
BackendChain::invalidateMultiple public function Marks cache items as invalid. Overrides CacheBackendInterface::invalidateMultiple
BackendChain::invalidateTags public function Marks cache items with any of the specified tags as invalid. Overrides CacheTagsInvalidatorInterface::invalidateTags
BackendChain::prependBackend public function Prepends a cache backend to the cache chain.
BackendChain::removeBin public function Remove a cache bin. Overrides CacheBackendInterface::removeBin
BackendChain::set public function Stores data in the persistent cache. Overrides CacheBackendInterface::set
BackendChain::setMultiple public function Store multiple items in the persistent cache. Overrides CacheBackendInterface::setMultiple
BackendChain::__construct public function Constructs a DatabaseBackend object.
CacheBackendInterface::CACHE_PERMANENT constant Indicates that the item should never be removed unless explicitly deleted.

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Cache!BackendChain.php/class/BackendChain/8.1.x