@param string $key
@param string $tag

@return \Psr\Cache\CacheItemInterface
172413
private function getCacheItemFromKey($key, $tag)
    {
        $item = $this->cache->getItem(KeyNormalizer::noInvalid($key));

        if ($item instanceof TaggableCacheItemInterface) {
            $item->setTags(['router', $tag]);
        }

        return $item;
    }
1117912
public function set($key, $tag)
    {
        if ($tag instanceof Tag) {
            throw InvalidTagException::build([], ['invalidTag' => $tag]);
        }

        parent::set($key, $tag);
    }
1267338
protected function getOrCreateTag($label)
    {
        if (isset($this->tagFirstLevelCache[$label])) {
            return $this->tagFirstLevelCache[$label];
        }

        $tag = $this->tagRepository->findOneByLabel($label);

        if ($tag === null) {
            $tag = new Tag($label);
            $this->tagRepository->add($tag);
        }

        $this->tagFirstLevelCache[$label] = $tag;

        return $tag;
    }
1098747
private function purgeByCacheTag($tag)
    {
        $cacheTagsCacheDir = $this->getTagPath($tag);
        if (!file_exists($cacheTagsCacheDir) || !is_dir($cacheTagsCacheDir)) {
            return;
        }

        $files = (new Finder())->files()->in($cacheTagsCacheDir);
        foreach ($files as $file) {
            // @todo Change to be able to reuse parent::invalidate() or parent::purge() ?
            if ($digest = file_get_contents($file->getRealPath())) {
                @unlink($this->getPath($digest));
            }
            @unlink($file);
        }
        // We let folder stay in case another process have just written new cache tags.
    }
224992
public function delete($key, $tags = '')
    {
        $cache = app('cache');

        if (!empty($tags)) {
            $tags = json_decode($tags, true);
            $cache = $cache->tags($tags);
        } else {
            unset($tags);
        }

        $success = $cache->forget($key);

        return response()->json(compact('success'));
    }
146260
protected function getTags($tag = null)
    {
        $tags = [$this->cacheKey];

        if ($tag) {
            if (! is_array($tag)) {
                $tag = [$tag];
            }

            $tags = array_merge($tags, $tag);
        }

        return $tags;
    }
1325205
public function get($cacheGroupKey, array $params = [], $tags = null)
    {
        // Make sure caching is enabled
        if (!$this->isCachingEnabled()) {
            return;
        }

        // Retrieve cache group settings
        $cacheGroup = $this->getCacheGroup($cacheGroupKey);

        // Set cache tag to group name
        if (!$tags) {
            $tags = $cacheGroupKey;
        }

        if (empty($cacheGroup) || (empty($cacheGroup['active']) || empty($cacheGroup['key']))) {
            return;
        }

        // Generate cache key
        $cacheKey = $this->generateCacheKey($cacheGroup['key'], $params);

        return IlluminateCache::tags($tags)->get($cacheKey);
    }
1350222
protected function invalidateCache(array $tags, $time = null)
    {
        if ($this->_cache) {
            $this->_cache->invalidateTags($tags, $time);
        }

        return $this;
    }
1170046
public function store($key, $code, $tag = null, $php = true) {
		$content = "";
		if ($php)
			$content = self::PHP_TAG;
		$content .= $code . "\n";
		$this->storeContent ( $key, $content, $tag );
	}
950203
public static function withTag($tag)
    {
        $element = (new ReflectionClass(static::class))->newInstanceWithoutConstructor();

        $element->tag = $tag;
        $element->attributes = new Attributes();
        $element->children = new Collection();

        return $element;
    }
609504
public function getCachedItem($key)
    {
        $path = sha1($key);

        if ($this->filesystem()->has($path)) {
            $item = explode(PHP_EOL, $this->filesystem()->read($path), 2);

            return new CacheItemClass($key, $item[1] ?? null, $item[0] ?? null);
        }
    }
646239
final public function delete(TagKey $key): bool
    {
        if (!\array_key_exists($key->getName(), $this->m)) {
            return false;
        }
        unset($this->m[$key->getName()]);
        return true;
    }
1370709
public static function invalidate($cache, $tags): void
    {
        $keys = [];
        foreach ((array) $tags as $tag) {
            $keys[] = static::buildCacheKey($tag);
        }
        static::touchKeys($cache, $keys);
    }
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;
        }
    }
875127
public function destroy(TagRequest $request, Tag $tag)
    {
        try {

            $tag->delete();
            return $this->response->message(trans('messages.success.deleted', ['Module' => trans('blog::tag.name')]))
                ->code(202)
                ->status('success')
                ->url(guard_url('blog/tag/0'))
                ->redirect();

        } catch (Exception $e) {

            return $this->response->message($e->getMessage())
                ->code(400)
                ->status('error')
                ->url(guard_url('blog/tag/' . $tag->getRouteKey()))
                ->redirect();
        }

    }
389023
public function tag($tag, array $keys)
	{
		foreach ($keys as $key)
		{
			$resolvedKey = $this->resolveAlias($key);

			if (!isset($this->tags[$tag]))
			{
				$this->tags[$tag] = array();
			}

			$this->tags[$tag][] = $resolvedKey;
		}

		// Prune duplicates
		$this->tags[$tag] = array_unique($this->tags[$tag]);

		return $this;
	}
466515
private function saveDeferred($key, $data, $expiresAfter = null, $tags = [])
    {
        $item = $this->cache->getItem($key);
        $item->set($data);
        $item->expiresAfter($expiresAfter);

        if (0 !== \count($tags)) {
            $item->tag($tags);
        }

        return $this->cache->saveDeferred($item);
    }