You are here

public function DatabaseBackend::deleteAll in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::deleteAll()
  2. 9 core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::deleteAll()

File

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

Class

DatabaseBackend
Defines a default cache implementation.

Namespace

Drupal\Core\Cache

Code

public function deleteAll() {
  try {
    $this->connection
      ->truncate($this->bin)
      ->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);
    }
  }
}