Delete all index entries that match the given list of tags.
Note: Only entries that match all tags will be deleted.

@param array $tags

@return bool True if save was successful, otherwise false.
@throws HrcException
774567
public function deleteEntryByTags(array $tags)
    {
        if (count($tags) < 1) {
            throw new HrcException('You need to provide at least one tag.');
        }

        $tagFolder = str_replace($this->indexDir, '',
            rtrim($this->createFolderNameFromTags($tags), DIRECTORY_SEPARATOR));

        // remove index
        array_map('unlink', (glob($this->indexDir . '*' . $tagFolder . '*/*/*/*/index.db') ?: []));

        // remove inner folders
        $levelsToRemove = [
            $this->indexDir . '*' . $tagFolder . '*/*/*/*',
            $this->indexDir . '*' . $tagFolder . '*/*/*',
            $this->indexDir . '*' . $tagFolder . '*/*',
            $this->indexDir . '*' . $tagFolder . '*',
        ];

        // remove indexes
        foreach ($levelsToRemove as $lr) {
            array_map('rmdir', (glob($lr) ?: []));
        }
    }
1373247
public function removeTag(Tag $tag)
    {
        if ($this->tags->contains($tag)) {
            $this->tags->removeElement($tag);
            return true;
        }
        return false;
    }
579255
public function flushKeysForTags($tags)
    {
        $tags = is_array($tags) ? $tags : func_get_args();

        $cache = $this->getCache();

        $store = $cache->getStore();

        if (! $store instanceof RedisStore) {
            // we can't cache forever in this case. we need sets.
            return;
        }

        $connection = $store->connection();

        foreach ($tags as $tag) {
            $segment = $this->getCacheSegmentKey($tag);

            $this->deleteCacheValues($store->getPrefix().$segment, $connection, $cache);

            $cache->forget($segment);
        }
    }
876546
public function clearTag(string $tag): void
    {
        $keys = $this->getTagItems($tag);

        wincache_ucache_delete($keys);

        $tagName = $this->getTagkey($tag);
        $this->rm($tagName);
    }
1138173
public static function clearTags(array $tags): bool
    {
        if (self::getInstance() instanceof HierarchicalPoolInterface) {
            return self::getInstance()->invalidateTags($tags);
        }
        return false;
    }
952958
public function hasTag(string $tag): bool
    {
        return is_array($this->tags) && array_key_exists($tag, $this->tags);
    }
366015
public function removeTag(\Amulen\ClassificationBundle\Entity\Tag $tags)
    {
        $this->tags->removeElement($tags);
    }
999279
public function setTagsAttribute($tags): void
    {
        static::saved(function (self $model) use ($tags) {
            $model->syncTags($tags);
        });
    }
1299630
public function set(array $tags)
    {
        if (!empty($tags)) {
            foreach ($tags as $_tag) {
                if (is_array($_tag) && isset($_tag['name']) && isset($_tag['content'])) {
                    $this->add(
                        $_tag['name'],
                        $_tag['content'],
                        isset($_tag['http-equiv']) && true===$_tag['http-equiv'] ? true : false,
                        isset($_tag['condition']) ? $_tag['condition'] : null
                    );
                }
            }
        }
        return $this;
    }
462112
private function removeTag($tag)
    {
        try {
            if (isset($this->_hashmap[$tag])) {
                foreach (array_keys($this->_hashmap[$tag]) as $key) {
                    if (\apc_delete($key)) {
                        unset($this->_hashmap[$tag][$key]);
                    }
                }

                return $this->saveHashmap();
            }
        } catch (\Exception $e) {
            $this->log('warning', \sprintf('Unable to delete cache for tag %s : %s', $tag, $e->getMessage()));

            return false;
        }

        return true;
    }
1190079
public function deleteTag($tag)
    {
        $endPointUrl = $this->apiurl."/account/tag/".$tag;

        $response = $this->curlDelete($endPointUrl);

        return $response;
    }
785228
public function intersect(array $tags)
    {
        $result = new self();
        foreach ($tags as $tag) {
            if ($this->contains($tag)) {
                $result->addTag($tag);
            }
        }

        return $result;
    }
1243525
public function hasAllTags($tags): bool
    {
        // Single tag slug
        if (is_string($tags)) {
            return $this->tags->contains('slug', $tags);
        }

        // Single tag id
        if (is_int($tags)) {
            return $this->tags->contains('id', $tags);
        }

        // Single tag model
        if ($tags instanceof Tag) {
            return $this->tags->contains('slug', $tags->slug);
        }

        // Array of tag slugs
        if (is_array($tags) && isset($roles[0]) && is_string($tags[0])) {
            return $this->tags->pluck('slug')->count() === count($tags)
                   && $this->tags->pluck('slug')->diff($tags)->isEmpty();
        }

        // Array of tag ids
        if (is_array($tags) && isset($roles[0]) && is_string($tags[0])) {
            return $this->tags->pluck('id')->count() === count($tags)
                   && $this->tags->pluck('id')->diff($tags)->isEmpty();
        }

        // Collection of tag models
        if ($tags instanceof Collection) {
            return $this->tags->count() === $tags->count() && $this->tags->diff($tags)->isEmpty();
        }

        return false;
    }
390356
public function prune(array $tags)
    {
        $keys = [];

        foreach ($tags as $tag) {
            if (!isset($this->tag2Ids[$tag])) {
                continue;
            }
            $keys = $keys + array_keys($this->tag2Ids[$tag]);
        }

        foreach ($keys as $key) {
            $this->forget($key);
        }

        foreach ($tags as $tag) {
            if (isset($this->tag2Ids[$tag])) {
                unset($this->tag2Ids[$tag]);
            }
        }

        return $this;
    }
122054
public function setTags($tags, $type = 'name')
    {
        // Prepare the tags
        $tags = $this->prepareTags($tags);

        // Get the current entity tags
        $entityTags = $this->tags->pluck($type)->all();

        // Prepare the tags to be added and removed
        $tagsToAdd = array_diff($tags, $entityTags);
        $tagsToDel = array_diff($entityTags, $tags);

        // Detach the tags
        if (! empty($tagsToDel)) {
            $this->untag($tagsToDel);
        }

        // Attach the tags
        if (! empty($tagsToAdd)) {
            $this->tag($tagsToAdd);
        }

        return true;
    }
101019
public function tag($tags)
    {
        $tags = $this->makeTagsArray($tags);

        $this->addTags($tags);

        if (count($tags) > 0) {
            $this->tags()->sync(
                Tag::whereIn('tag', $tags)->pluck('id')->all()
            );

            return;
        }

        $this->tags()->detach();
    }
561210
public function flushByTags(array $tags)
    {
        $this->throwExceptionIfFrontendDoesNotExist();

        if (empty($tags)) {
            return;
        }

        $this->logger->debug('SFC flushByTags', [$tags]);

        $identifiers = [];
        foreach ($tags as $tag) {
            $identifiers = \array_merge($identifiers, $this->findIdentifiersByTagIncludingExpired($tag));
        }

        if ($this->isBoostMode()) {
            $this->getQueue()->addIdentifiers($identifiers);

            return;
        }

        foreach ($identifiers as $identifier) {
            $this->removeStaticFiles($identifier);
        }

        parent::flushByTags($tags);
    }