public static function clearTags($tags = [])
{
// do not disable clearing, it's better purging items here than having inconsistent data because of wrong usage
/*if (!self::$enabled) {
Logger::debug("Cache is not cleared because it is disabled");
return;
}*/
self::setWriteLock();
Logger::info("clear cache tags: " . implode(",", $tags));
// ensure that every tag is unique
$tags = array_unique($tags);
// check for ignored tags
foreach (self::$ignoredTagsOnClear as $t) {
$tagPosition = array_search($t, $tags);
if ($tagPosition !== false) {
array_splice($tags, $tagPosition, 1);
}
}
// check for the tag output, because items with this tags are only cleared after the process is finished
// the reason is that eg. long running importers will clean the output-cache on every save/update, that's not necessary,
// only cleaning the output-cache on shutdown should be enough
$outputTagPosition = array_search("output", $tags);
if ($outputTagPosition !== false) {
array_splice($tags, $outputTagPosition, 1);
self::addClearTagOnShutdown("output");
}
// add tag to clear stack
foreach ($tags as $tag) {
self::$clearedTagsStack[] = $tag;
}
// clean tags, except output
if ($cache = self::getInstance()) {
$cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, $tags);
}
}