You are here

protected function DatabaseBackend::ensureBinExists in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Cache/DatabaseBackend.php \Drupal\Core\Cache\DatabaseBackend::ensureBinExists()

Check if the cache bin exists and create it if not.

3 calls to DatabaseBackend::ensureBinExists()
DatabaseBackend::deleteAll in core/lib/Drupal/Core/Cache/DatabaseBackend.php
Deletes all cache items in a bin.
DatabaseBackend::deleteMultiple in core/lib/Drupal/Core/Cache/DatabaseBackend.php
Deletes multiple items from the cache.
DatabaseBackend::setMultiple in core/lib/Drupal/Core/Cache/DatabaseBackend.php
Store multiple items in the persistent cache.

File

core/lib/Drupal/Core/Cache/DatabaseBackend.php, line 361
Contains \Drupal\Core\Cache\DatabaseBackend.

Class

DatabaseBackend
Defines a default cache implementation.

Namespace

Drupal\Core\Cache

Code

protected function ensureBinExists() {
  try {
    $database_schema = $this->connection
      ->schema();
    if (!$database_schema
      ->tableExists($this->bin)) {
      $schema_definition = $this
        ->schemaDefinition();
      $database_schema
        ->createTable($this->bin, $schema_definition);
      return TRUE;
    }
  } catch (SchemaObjectExistsException $e) {
    return TRUE;
  }
  return FALSE;
}