function DatabaseCacheTagsChecksum::ensureTableExists

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php \Drupal\Core\Cache\DatabaseCacheTagsChecksum::ensureTableExists()
  2. 8.9.x core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php \Drupal\Core\Cache\DatabaseCacheTagsChecksum::ensureTableExists()
  3. 10 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();
        $schema_definition = $this->schemaDefinition();
        $database_schema->createTable('cachetags', $schema_definition);
    } catch (DatabaseException $e) {
    } catch (\Exception $e) {
        return FALSE;
    }
    return TRUE;
}

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