function MemoryBackend::garbageCollection
Same name in this branch
- 8.9.x core/lib/Drupal/Core/Cache/MemoryBackend.php \Drupal\Core\Cache\MemoryBackend::garbageCollection()
Same name in other branches
- 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()
- 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()
- 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()
Overrides FloodInterface::garbageCollection
File
-
core/
lib/ Drupal/ Core/ Flood/ MemoryBackend.php, line 77
Class
- MemoryBackend
- Defines the memory flood backend. This is used for testing.
Namespace
Drupal\Core\FloodCode
public function garbageCollection() {
foreach ($this->events as $name => $identifiers) {
foreach ($this->events[$name] as $identifier => $timestamps) {
// Filter by key (expiration) but preserve key => value associations.
$this->events[$name][$identifier] = array_filter($timestamps, function () use (&$timestamps) {
$expiration = key($timestamps);
next($timestamps);
return $expiration > microtime(TRUE);
});
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.