public function CacheTagsInvalidator::invalidateTags in Fastly 8.3
Marks cache items with any of the specified tags as invalid.
Parameters
string[] $tags: The list of tags for which to invalidate cache items.
Overrides CacheTagsInvalidatorInterface::invalidateTags
File
- src/
CacheTagsInvalidator.php, line 43
Class
- CacheTagsInvalidator
- Cache tags invalidator implementation that invalidates Fastly.
Namespace
Drupal\fastlyCode
public function invalidateTags(array $tags) {
// When either an extension (module/theme) is (un)installed, purge
// everything.
if (in_array('config:core.extension', $tags)) {
$this->api
->purgeAll();
return;
}
// Ignore config:fastly.settings.
if (in_array('config:fastly.settings', $tags)) {
return;
}
// Also invalidate the cache tags as hashes, to automatically also work for
// responses that exceed the 16 KB header limit.
$all_tags_and_hashes = $this->cacheTagsHash
->cacheTagsToHashes($tags);
$this->api
->purgeKeys($all_tags_and_hashes);
}