You are here

public function DatabaseRawBackend::deleteAll in Supercache 8

Same name and namespace in other branches
  1. 2.0.x src/Cache/DatabaseRawBackend.php \Drupal\supercache\Cache\DatabaseRawBackend::deleteAll()

Deletes all cache items in a bin.

Overrides CacheRawBackendInterface::deleteAll

See also

\Drupal\supercache\Cache\CacheRawBackendInterface::delete()

\Drupal\supercache\Cache\CacheRawBackendInterface::deleteMultiple()

File

src/Cache/DatabaseRawBackend.php, line 306
Contains \Drupal\supercache\Cache\DatabaseRawBackend.

Class

DatabaseRawBackend
Defines a default cache implementation.

Namespace

Drupal\supercache\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);
    }
  }
}