Returns the timestamps for the specified tags.
@param Cache $cache
@param string[] $tags
@return array the timestamps indexed by the specified tags.
321782
protected function getTimestamps($cache, $tags)
    {
        if (empty($tags)) {
            return [];
        }

        $keys = [];
        foreach ($tags as $tag) {
            $keys[] = $cache->buildKey([__CLASS__, $tag]);
        }

        return $cache->mget($keys);
    }
879126
public function get(string $key, array $tags)
    {
        return $this->cache->tags($tags)->get($key);
    }
1021650
public function selectByTags(array $tags)
    {
        $result = [];
        foreach ($this->array['Key2Tags'] as $key => $keyTags) {
            $found = true;
            foreach ($tags as $t) {
                if (array_search($t, $keyTags)===false) {
                    $found = false;
                }
            }

            if ($found) {
                $result[] = $key;
            }
        }

        return $result;
    }
310248
public function runChecks($tags = [])
    {
        $errors = [];

        $checks = $this->getChecks();

        if (!empty($tags)) {
            $taggedChecks = [];
            foreach ($checks as $check) {
                // a check can have many tags
                // true if any of the tags provided appears in the check tags
                if (array_intersect($check['tags'], $tags)) {
                    $taggedChecks[] = $check;
                }
            }
            $checks = $taggedChecks;
        }

        foreach ($checks as $check) {
            $functionName = '';
            if (is_array($check['check'])) {
                if (count($check['check']) > 1) {
                    $obj = reset($check['check']);
                    $method = end($check['check']);
                    $functionName = get_class($obj).'::'.$method;
                } else {
                    $functionName = reset($check['check']);
                }
            }

            $errors = array_merge($errors, call_user_func($check['check']));

            assert(
                is_array($errors),
                sprintf(
                    'The function %s did not return a list. All functions registered ".
            "with the checks registry must return a list.',
                    $functionName
                )
            );
        }

        return $errors;
    }
635545
static function fetchByTag( $tagName, $cacheInfoList = false )
    {
        if ( !$cacheInfoList )
            $cacheInfoList = eZCache::fetchList();

        $cacheEntries = array();
        $tagList = explode( ',', $tagName );
        foreach ( $cacheInfoList as $cacheInfo )
        {
            if ( !is_array( $cacheInfo['tag'] ) )
                continue;

            $matchingTags = array_intersect( $tagList, $cacheInfo['tag'] );
            if ( !empty( $matchingTags ) )
                $cacheEntries[] = $cacheInfo;
        }

        return $cacheEntries;
    }
1321660
public function flushCache($cacheTags = null)
    {
        $cache = $this->getCacheDriver();

        if ( ! method_exists($cache, 'tags')) {
            return false;
        }

        $cacheTags = $cacheTags ?: $this->cacheTags;

        $cache->tags($cacheTags)->flush();

        return true;
    }
848768
public function cache($id = null, $tags = [])
    {
        $this->_shouldCache = $id === false ? false : true;
        $this->_cacheId = is_string($id) ? $id : $this->_cacheId;
        $this->_cacheTags = $tags ? (array) $tags : $this->_cacheTags;

        return $this;
    }
891576
protected function findIdentifiersByTagIncludingExpired($tag): array
    {
        $base = (new DateTimeService())->getCurrentTime();
        $GLOBALS['EXEC_TIME'] = 0;
        $identifiers = $this->findIdentifiersByTag($tag);
        $GLOBALS['EXEC_TIME'] = $base;

        return $identifiers;
    }
1010405
public function tags($names)
    {
        if (! method_exists($this->store, 'tags')) {
            throw new BadMethodCallException('This cache store does not support tagging.');
        }

        $cache = $this->store->tags(is_array($names) ? $names : func_get_args());

        if (! is_null($this->events)) {
            $cache->setEventDispatcher($this->events);
        }

        return $cache->setDefaultCacheTime($this->default);
    }
216020
protected function getCache()
    {
        $cache = $this->connection->getCacheManager()->driver($this->cacheDriver);

        return $this->cacheTags ? $cache->tags($this->cacheTags) : $cache;
    }
1023501
public function invalidateTags(array $tags)
    {
        if (!$this->cache instanceof TagAwareAdapterInterface) {
            throw new \RuntimeException('Cannot invalidate tags on a cache
            implementation that does not implement the TagAwareAdapterInterface.');
        }

        try {
            return $this->cache->invalidateTags($tags);
        } catch (InvalidArgumentException $e) {
            return false;
        }
    }
713359
public function flushCachesByTag(string $tag, bool $flushPersistentCaches = false): void
    {
        $this->createAllCaches();
        /** @var FrontendInterface $cache */
        foreach ($this->caches as $identifier => $cache) {
            if (!$flushPersistentCaches && $this->isCachePersistent($identifier)) {
                continue;
            }
            $cache->flushByTag($tag);
        }
    }
101402
public function time($metric, $func, array $tags = array())
    {
        $timer_start = microtime(true);
        $func();
        $timer_end = microtime(true);
        $time = round(($timer_end - $timer_start) * 1000, 4);
        return $this->timing($metric, $time, $tags);
    }
443796
public function getCache($cache)
    {
        $cache = self::encodeCache($cache);
        $url = "projects/{$this->project_id}/caches/$cache";
        $this->setJsonHeaders();
        return self::json_decode($this->apiCall(self::GET, $url));
    }
666001
private function getContextFromTags(array $tags)
    {
        return array_filter(array_map(static function (array $attribute) {
            if (\array_key_exists('context', $attribute) && \is_string($attribute['context'])) {
                return $attribute['context'];
            }

            return null;
        }, $tags));
    }
698745
public function getIdsMatchingTags($tags = array())
    {
        $first = true;
        $ids = array();
        foreach ($tags as $tag) {
            $res = $this->_query("SELECT DISTINCT(id) AS id FROM tag WHERE name='$tag'");
            if (!$res) {
                return array();
            }
            $rows = @sqlite_fetch_all($res, SQLITE_ASSOC);
            $ids2 = array();
            foreach ($rows as $row) {
                $ids2[] = $row['id'];
            }
            if ($first) {
                $ids = $ids2;
                $first = false;
            } else {
                $ids = array_intersect($ids, $ids2);
            }
        }
        $result = array();
        foreach ($ids as $id) {
            $result[] = $id;
        }
        return $result;
    }
1301825
protected function checkCacheTags(array $tags)
    {
        $invalidTags = array_diff(array_keys($tags), ['tagId', 'tagKeyword']);
        if (count($invalidTags) > 0) {
            throw new InvalidArgumentException(
                'cacheTags',
                'Unknown cache tag(s): ' . implode(', ', $invalidTags)
            );
        }

        return $tags;
    }