function CacheTagsChecksumTrait::invalidateTags
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php \Drupal\Core\Cache\CacheTagsChecksumTrait::invalidateTags()
- 10 core/lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php \Drupal\Core\Cache\CacheTagsChecksumTrait::invalidateTags()
- 11.x core/lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php \Drupal\Core\Cache\CacheTagsChecksumTrait::invalidateTags()
Implements \Drupal\Core\Cache\CacheTagsInvalidatorInterface::invalidateTags()
File
-
core/
lib/ Drupal/ Core/ Cache/ CacheTagsChecksumTrait.php, line 53
Class
- CacheTagsChecksumTrait
- A trait for cache tag checksum implementations.
Namespace
Drupal\Core\CacheCode
public function invalidateTags(array $tags) {
// Only invalidate tags once per request unless they are written again.
foreach ($tags as $key => $tag) {
if (isset($this->invalidatedTags[$tag])) {
unset($tags[$key]);
}
else {
$this->invalidatedTags[$tag] = TRUE;
unset($this->tagCache[$tag]);
}
}
if (!$tags) {
return;
}
$in_transaction = $this->getDatabaseConnection()
->inTransaction();
if ($in_transaction) {
if (empty($this->delayedTags)) {
$this->getDatabaseConnection()
->addRootTransactionEndCallback([
$this,
'rootTransactionEndCallback',
]);
}
$this->delayedTags = Cache::mergeTags($this->delayedTags, $tags);
}
else {
$this->doInvalidateTags($tags);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.