Finds and returns all cache entry identifiers which are tagged by the
specified tag.

@param string $tag The tag to search for

@return array An array with identifiers of all matching entries. An empty array if no entries matched

@api
165880
public function findIdentifiersByTag($tag)
    {
        $tagsFiles = \glob(GeneralUtility::getFileAbsFileName(self::RELATIVE_STORAGE_FOLDER) . '*/*/*' . self::FILE_EXTENSION_TAG);
        $identifiers = [];
        foreach ($tagsFiles as $tagsFile) {
            if (false !== \mb_strpos(\file_get_contents($tagsFile), '|' . $tag . '|')) {
                $identifiers[] = \file_get_contents(\str_replace(self::FILE_EXTENSION_TAG, self::FILE_EXTENSION_IDENTIFIER, $tagsFile));
            }
        }

        return $identifiers;
    }
972052
public function tag($tag)
    {
        $route = $this->factory->createRoute($this, null, array());

        $this->addRoute($route);

        return $route->tag($tag);
    }
1328711
public function getEntry($tag)
    {
        if (isset($this->entries[$tag])) {
            return $this->entries[$tag];
        } else {
            return null;
        }
    }
354668
public function withTag($tag): Identifier
    {
        $obj = clone $this;
        $obj->_tag = new BigInt($tag);
        return $obj;
    }
45810
public function getPostsByTag($tag)
    {
        if (false === array_key_exists($tag, $this->tagsIndex)) {
            return [];
        }

        $postNames = $this->tagsIndex[$tag];

        return $this->getPostsByName($postNames);
    }
750135
public function getReleaseByTagName(string $tag): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/releases/tags/:tag',
            $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo(), $tag));
    }
902319
public function tag(string $tag): array
    {
        return $this->hasTag($tag) ? $this->tags[$tag] : null;
    }
454986
private function tag_has_name(string $tag){
    return in_array('name', array_values(
      \is_array($this->tags[$tag]) ?
        $this->tags[$tag] :
        $this->tags[$this->tags[$tag]]
    ));
  }
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;
    }
1264940
public function getSessionsByTag($tag)
    {
        $taggedSessions = [];
        foreach ($this->metaDataCache->getByTag(Session::TAG_PREFIX . $tag) as $sessionIdentifier => $sessionInfo) {
            $session = new Session($sessionIdentifier, $sessionInfo['storageIdentifier'], $sessionInfo['lastActivityTimestamp'], $sessionInfo['tags']);
            $taggedSessions[] = $session;
        }
        return $taggedSessions;
    }
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;
    }
555552
public function getTagPath($tag = null)
    {
        $path = $this->root . DIRECTORY_SEPARATOR . static::TAG_CACHE_DIR;
        if ($tag) {
            // Flip the tag so we put id first so it gets sliced into folders.
            // (otherwise we would easily reach inode limits on file system)
            $tag = strrev($tag);
            $path .= DIRECTORY_SEPARATOR . substr($tag, 0, 2) . DIRECTORY_SEPARATOR . substr($tag, 2, 2) . DIRECTORY_SEPARATOR . substr($tag, 4);
        }

        return $path;
    }
817137
protected function _findFirst(int $tag)
    {
        foreach ($this->_names as $name) {
            if ($name->tag() == $tag) {
                return $name;
            }
        }
        return null;
    }
458389
public function show(string $tag)
    {
        $tags = Tag::latest('count')
            ->where('name', 'like', '%'.$tag.'%')
            ->limit(10)
            ->get()
            ->map(function ($item) {
                return [
                    'id'    => $item['name'],
                    'text'  => $item['name'],
                    'count' => $item['count'],
                ];
            })
            ->toArray();

        return response()->json($tags);
    }
1181024
public function tagged($tag)
    {
        $results = [];

        if (isset($this->tags[$tag])) {
            foreach ($this->tags[$tag] as $abstract) {
                $results[] = $this->make($abstract);
            }
        }

        return $results;
    }
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;
    }
291790
public function flush($tag)
    {
        if ($this->isTaggable()) {
            return Cache::tags($tag)->flush();
        }

        return Cache::flush();
    }