function DatabaseBackend::deleteAll
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::deleteAll()
- 10 core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::deleteAll()
- 9 core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::deleteAll()
- 8.9.x core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::deleteAll()
Deletes all cache items in a bin.
Overrides CacheBackendInterface::deleteAll
File
-
core/
lib/ Drupal/ Core/ Cache/ DatabaseBackend.php, line 335
Class
- DatabaseBackend
- Defines a default cache implementation.
Namespace
Drupal\Core\CacheCode
public function deleteAll() {
try {
$this->connection
->truncate($this->bin)
->execute();
} 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->connection
->truncate($this->bin)
->execute();
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.