public function DatabaseBackend::deleteAll

public DatabaseBackend::deleteAll()

Deletes all cache items in a bin.

Overrides CacheBackendInterface::deleteAll

See also

\Drupal\Core\Cache\CacheBackendInterface::invalidateAll()

\Drupal\Core\Cache\CacheBackendInterface::delete()

\Drupal\Core\Cache\CacheBackendInterface::deleteMultiple()

File

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

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);
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Cache!DatabaseBackend.php/function/DatabaseBackend::deleteAll/8.1.x