function DatabaseBackend::deleteMultiple
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::deleteMultiple()
- 10 core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::deleteMultiple()
- 9 core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::deleteMultiple()
- 8.9.x core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::deleteMultiple()
Deletes multiple items from the cache.
If the cache items are being deleted because they are no longer "fresh", you may consider using invalidateMultiple() instead. This allows callers to retrieve the invalid items by calling get() with $allow_invalid set to TRUE. In some cases an invalid item may be acceptable rather than having to rebuild the cache.
Parameters
array $cids: An array of cache IDs to delete.
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 300
Class
- DatabaseBackend
- Defines a default cache implementation.
Namespace
Drupal\Core\CacheCode
public function deleteMultiple(array $cids) {
$cids = array_values(array_map([
$this,
'normalizeCid',
], $cids));
try {
$this->doDeleteMultiple($cids);
} catch (\Exception) {
// Make the cache table. The new table is empty. During core
// installation, it is possible to clear a cache table before items are
// in it, for example {cache_render} and {cache_data}. If the table is
// already there, it is possible that another process made it after the
// query failed. In this condition, do the query again.
if (!$this->ensureBinExists()) {
$this->doDeleteMultiple($cids);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.