function DatabaseCacheTagsChecksum::ensureTableExists

Same name in other branches
  1. 9 core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php \Drupal\Core\Cache\DatabaseCacheTagsChecksum::ensureTableExists()
  2. 10 core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php \Drupal\Core\Cache\DatabaseCacheTagsChecksum::ensureTableExists()
  3. 11.x core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php \Drupal\Core\Cache\DatabaseCacheTagsChecksum::ensureTableExists()

Check if the cache tags table exists and create it if not.

2 calls to DatabaseCacheTagsChecksum::ensureTableExists()
DatabaseCacheTagsChecksum::doInvalidateTags in core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php
Marks cache items with any of the specified tags as invalid.
DatabaseCacheTagsChecksum::getTagInvalidationCounts in core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php
Fetches invalidation counts for cache tags.

File

core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php, line 75

Class

DatabaseCacheTagsChecksum
Cache tags invalidations checksum implementation that uses the database.

Namespace

Drupal\Core\Cache

Code

protected function ensureTableExists() {
    try {
        $database_schema = $this->connection
            ->schema();
        // Create the cache tags table if it does not exist.
        if (!$database_schema->tableExists('cachetags')) {
            $schema_definition = $this->schemaDefinition();
            $database_schema->createTable('cachetags', $schema_definition);
            return TRUE;
        }
    } catch (DatabaseException $e) {
        return TRUE;
    }
    return FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.