You are here

public function DatabaseStorage::deleteMultiple in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php \Drupal\Core\KeyValueStore\DatabaseStorage::deleteMultiple()

Deletes multiple items from the key/value store.

Parameters

array $keys: A list of item names to delete.

Overrides KeyValueStoreInterface::deleteMultiple

1 call to DatabaseStorage::deleteMultiple()
DatabaseStorageExpirable::deleteMultiple in core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php
Deletes multiple items from the key/value store.
1 method overrides DatabaseStorage::deleteMultiple()
DatabaseStorageExpirable::deleteMultiple in core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php
Deletes multiple items from the key/value store.

File

core/lib/Drupal/Core/KeyValueStore/DatabaseStorage.php, line 220

Class

DatabaseStorage
Defines a default key/value store implementation.

Namespace

Drupal\Core\KeyValueStore

Code

public function deleteMultiple(array $keys) {

  // Delete in chunks when a large array is passed.
  while ($keys) {
    try {
      $this->connection
        ->delete($this->table)
        ->condition('name', array_splice($keys, 0, 1000), 'IN')
        ->condition('collection', $this->collection)
        ->execute();
    } catch (\Exception $e) {
      $this
        ->catchException($e);
    }
  }
}