function DatabaseBackend::deleteMultiple

Same name in other branches
  1. 9 core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::deleteMultiple()
  2. 8.9.x core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::deleteMultiple()
  3. 11.x core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::deleteMultiple()

Overrides CacheBackendInterface::deleteMultiple

1 call to DatabaseBackend::deleteMultiple()
DatabaseBackend::delete in core/lib/Drupal/Core/Cache/DatabaseBackend.php

File

core/lib/Drupal/Core/Cache/DatabaseBackend.php, line 326

Class

DatabaseBackend
Defines a default cache implementation.

Namespace

Drupal\Core\Cache

Code

public function deleteMultiple(array $cids) {
    $cids = array_values(array_map([
        $this,
        'normalizeCid',
    ], $cids));
    try {
        // Delete in chunks when a large array is passed.
        foreach (array_chunk($cids, 1000) as $cids_chunk) {
            $this->connection
                ->delete($this->bin)
                ->condition('cid', $cids_chunk, 'IN')
                ->execute();
        }
    } catch (\Exception $e) {
        // Create the cache table, which will be empty. This fixes cases during
        // core install where a cache table is cleared before it is set
        // with {cache_render} and {cache_data}.
        if (!$this->ensureBinExists()) {
            $this->catchException($e);
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.