You are here

public function KeyValueDatabaseExpirableFactory::garbageCollection in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseExpirableFactory.php \Drupal\Core\KeyValueStore\KeyValueDatabaseExpirableFactory::garbageCollection()
  2. 9 core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseExpirableFactory.php \Drupal\Core\KeyValueStore\KeyValueDatabaseExpirableFactory::garbageCollection()

Deletes expired items.

File

core/lib/Drupal/Core/KeyValueStore/KeyValueDatabaseExpirableFactory.php, line 60

Class

KeyValueDatabaseExpirableFactory
Defines the key/value store factory for the database backend.

Namespace

Drupal\Core\KeyValueStore

Code

public function garbageCollection() {
  try {
    $this->connection
      ->delete('key_value_expire')
      ->condition('expire', REQUEST_TIME, '<')
      ->execute();
  } catch (\Exception $e) {
    $this
      ->catchException($e);
  }
}