You are here

public function MemoryBackend::garbageCollection in Drupal 10

Same name in this branch
  1. 10 core/lib/Drupal/Core/Flood/MemoryBackend.php \Drupal\Core\Flood\MemoryBackend::garbageCollection()
  2. 10 core/lib/Drupal/Core/Cache/MemoryBackend.php \Drupal\Core\Cache\MemoryBackend::garbageCollection()
Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Flood/MemoryBackend.php \Drupal\Core\Flood\MemoryBackend::garbageCollection()
  2. 9 core/lib/Drupal/Core/Flood/MemoryBackend.php \Drupal\Core\Flood\MemoryBackend::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\Flood

Code

public function garbageCollection() {
  foreach ($this->events as $name => $identifiers) {
    foreach ($this->events[$name] as $identifier => $entries) {

      // Remove expired entries.
      $this->events[$name][$identifier] = array_filter($entries, function ($entry) {
        return $entry['expire'] > microtime(TRUE);
      });
    }
  }
}