function DatabaseCacheTagsChecksum::doInvalidateTags
Same name in other branches
- 9 core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php \Drupal\Core\Cache\DatabaseCacheTagsChecksum::doInvalidateTags()
- 10 core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php \Drupal\Core\Cache\DatabaseCacheTagsChecksum::doInvalidateTags()
- 11.x core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php \Drupal\Core\Cache\DatabaseCacheTagsChecksum::doInvalidateTags()
Overrides CacheTagsChecksumTrait::doInvalidateTags
File
-
core/
lib/ Drupal/ Core/ Cache/ DatabaseCacheTagsChecksum.php, line 35
Class
- DatabaseCacheTagsChecksum
- Cache tags invalidations checksum implementation that uses the database.
Namespace
Drupal\Core\CacheCode
protected function doInvalidateTags(array $tags) {
try {
foreach ($tags as $tag) {
$this->connection
->merge('cachetags')
->insertFields([
'invalidations' => 1,
])
->expression('invalidations', 'invalidations + 1')
->key('tag', $tag)
->execute();
}
} catch (\Exception $e) {
// Create the cache table, which will be empty. This fixes cases during
// core install where cache tags are invalidated before the table is
// created.
if (!$this->ensureTableExists()) {
$this->catchException($e);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.