protected function DatabaseCacheTagsChecksum::getTagInvalidationCounts in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php \Drupal\Core\Cache\DatabaseCacheTagsChecksum::getTagInvalidationCounts()
Fetches invalidation counts for cache tags.
Parameters
string[] $tags: The list of tags to fetch invalidations for.
Return value
int[] List of invalidation counts keyed by the respective cache tag.
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\CacheCode
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()) {
$this
->catchException($e);
}
}
return [];
}