function DatabaseCacheTagsChecksum::getTagInvalidationCounts

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

Overrides CacheTagsChecksumTrait::getTagInvalidationCounts

File

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

Class

DatabaseCacheTagsChecksum
Cache tags invalidations checksum implementation that uses the database.

Namespace

Drupal\Core\Cache

Code

protected function getTagInvalidationCounts(array $tags) {
    try {
        return $this->connection
            ->query('SELECT [tag], [invalidations] FROM {cachetags} WHERE [tag] IN ( :tags[] )', [
            ':tags[]' => $tags,
        ])
            ->fetchAllKeyed();
    } catch (\Exception $e) {
        // If the table does not exist yet, create.
        if (!$this->ensureTableExists()) {
            throw $e;
        }
    }
    return [];
}

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