function MemoryBackend::garbageCollection
Same name in this branch
- main core/lib/Drupal/Core/Flood/MemoryBackend.php \Drupal\Core\Flood\MemoryBackend::garbageCollection()
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Flood/MemoryBackend.php \Drupal\Core\Flood\MemoryBackend::garbageCollection()
- 11.x core/lib/Drupal/Core/Cache/MemoryBackend.php \Drupal\Core\Cache\MemoryBackend::garbageCollection()
- 10 core/lib/Drupal/Core/Flood/MemoryBackend.php \Drupal\Core\Flood\MemoryBackend::garbageCollection()
- 10 core/lib/Drupal/Core/Cache/MemoryBackend.php \Drupal\Core\Cache\MemoryBackend::garbageCollection()
- 9 core/lib/Drupal/Core/Flood/MemoryBackend.php \Drupal\Core\Flood\MemoryBackend::garbageCollection()
- 9 core/lib/Drupal/Core/Cache/MemoryBackend.php \Drupal\Core\Cache\MemoryBackend::garbageCollection()
- 8.9.x core/lib/Drupal/Core/Flood/MemoryBackend.php \Drupal\Core\Flood\MemoryBackend::garbageCollection()
- 8.9.x core/lib/Drupal/Core/Cache/MemoryBackend.php \Drupal\Core\Cache\MemoryBackend::garbageCollection()
Performs garbage collection on a cache bin.
The backend may choose to delete expired or invalidated items.
Overrides CacheBackendInterface::garbageCollection
File
-
core/
lib/ Drupal/ Core/ Cache/ MemoryBackend.php, line 201
Class
- MemoryBackend
- Defines a memory cache implementation.
Namespace
Drupal\Core\CacheCode
public function garbageCollection() {
$requestTime = $this->time
->getRequestTime();
$this->cache = array_filter($this->cache, function ($item) use ($requestTime) {
return $item->expire == Cache::PERMANENT || $item->expire >= $requestTime;
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.