class NullBackend
Same name in other branches
- 9 core/lib/Drupal/Core/Cache/NullBackend.php \Drupal\Core\Cache\NullBackend
- 8.9.x core/lib/Drupal/Core/Cache/NullBackend.php \Drupal\Core\Cache\NullBackend
- 11.x core/lib/Drupal/Core/Cache/NullBackend.php \Drupal\Core\Cache\NullBackend
Defines a stub cache implementation.
The stub implementation is needed when database access is not yet available. Because Drupal's caching system never requires that cached data be present, these stub functions can short-circuit the process and sidestep the need for any persistent storage. Using this cache implementation during normal operations would have a negative impact on performance.
This also can be used for testing purposes.
Hierarchy
- class \Drupal\Core\Cache\NullBackend implements \Drupal\Core\Cache\CacheBackendInterface
Expanded class hierarchy of NullBackend
Related topics
16 files declare their use of NullBackend
- CachedStorageTest.php in core/
tests/ Drupal/ Tests/ Core/ Config/ CachedStorageTest.php - CheckpointStorageTest.php in core/
tests/ Drupal/ Tests/ Core/ Config/ Checkpoint/ CheckpointStorageTest.php - ContextDefinitionIsSatisfiedTest.php in core/
tests/ Drupal/ Tests/ Core/ Plugin/ Context/ ContextDefinitionIsSatisfiedTest.php - ContextHandlerTest.php in core/
tests/ Drupal/ Tests/ Core/ Plugin/ ContextHandlerTest.php - Database.php in core/
lib/ Drupal/ Core/ Database/ Database.php
File
-
core/
lib/ Drupal/ Core/ Cache/ NullBackend.php, line 18
Namespace
Drupal\Core\CacheView source
class NullBackend implements CacheBackendInterface {
/**
* Constructs a NullBackend object.
*
* @param string $bin
* The cache bin for which the object is created.
*/
public function __construct($bin) {
}
/**
* {@inheritdoc}
*/
public function get($cid, $allow_invalid = FALSE) {
return FALSE;
}
/**
* {@inheritdoc}
*/
public function getMultiple(&$cids, $allow_invalid = FALSE) {
return [];
}
/**
* {@inheritdoc}
*/
public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = []) {
}
/**
* {@inheritdoc}
*/
public function setMultiple(array $items = []) {
}
/**
* {@inheritdoc}
*/
public function delete($cid) {
}
/**
* {@inheritdoc}
*/
public function deleteMultiple(array $cids) {
}
/**
* {@inheritdoc}
*/
public function deleteAll() {
}
/**
* {@inheritdoc}
*/
public function invalidate($cid) {
}
/**
* {@inheritdoc}
*/
public function invalidateMultiple(array $cids) {
}
/**
* {@inheritdoc}
*/
public function invalidateAll() {
}
/**
* {@inheritdoc}
*/
public function garbageCollection() {
}
/**
* {@inheritdoc}
*/
public function removeBin() {
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.