Test if an item exists.

@param string $cacheId
@param bool   $withVersion

@throws \Psr\SimpleCache\InvalidArgumentException

@return bool
557961
public function hasItem(string $cacheId, bool $withVersion = true) : bool
    {
        if ($withVersion) {
            $cacheId .= '.' . $this->getVersion();
        }

        return $this->cache->has($cacheId);
    }
406296
public function getItem($cacheId, & $success = null)
    {
        $cacheId = $this->normalizeKey($cacheId);

        $storedValue = apc_fetch($cacheId, $success);
        if (false === $success) {
            $success = false;

            return null;
        }

        $value = $this->extract($storedValue);

        if ($value === null) {
            $success = false;

            return null;
        }

        $success = true;

        return $value;
    }
1158306
public function setItem($cacheId, $value)
    {
        $cacheId = $this->normalizeKey($cacheId);
        $expire  = $this->cacheExpiration;

        $this->memcached->set(
            $cacheId,
            $this->compact($value),
            ($expire === 0) ? $expire : time() + $expire
        );

        return (\Memcached::RES_SUCCESS === $this->memcached->getResultCode());
    }
698013
public function exists($id, $version = null)
    {
        $list = $this->getList(array('id' => $id, 'version' => $version));
        return !empty($list);
    }
476535
public function hasItem($cacheId)
    {
        $cacheId = $this->normalizeKey($cacheId);

        try {
            return $this->cache->hasItem($cacheId);
        } catch (ZendException\ExceptionInterface $ex) {
            return false;
        }
    }
927840
public function getItem($cacheId, & $success = null)
    {
        $cacheId = $this->normalizeKey($cacheId);
        $success = false;

        $storedValue = $this->memcached->get($cacheId);
        if (\Memcached::RES_SUCCESS !== $this->memcached->getResultCode()) {
            return null;
        }

        $value = $this->extract($storedValue);
        if ($value === null) {
            return null;
        }

        $success = true;

        return $value;
    }
83976
public function has($id)
    {
        if (array_key_exists($id, $this->entityClassNameCache)) {
            return false !== $this->entityClassNameCache[$id];
        }

        $objectManagerAutoDetector = $this->getObjectManagerAutoDetector();
        if (!$objectManagerAutoDetector->hasObjectManagerNameByClassName($id)) {
            $this->entityClassNameCache[$id] = false;
            return false;
        }
        $objectManagerName = $objectManagerAutoDetector->getObjectManagerNameByClassName($id);

        $doctrineOrmModuleConfig = $this->getDoctrineOrmModuleConfig();
        if (!$doctrineOrmModuleConfig->hasNamespacesByObjectManager($objectManagerName)) {
            $this->entityClassNameCache[$id] = false;
            return false;
        }

        $namespacesIndex = $doctrineOrmModuleConfig->getNamespacesIndexByObjectManagerName($objectManagerName);

        if (false === $this->hasEntityPostfixByInterfaceName($id)) {
            $this->entityClassNameCache[$id] = false;
            return false;
        }
        $entityPostfix = $this->getEntityPostfixByInterfaceName($id);

        $entityClassName = $this->resolveEntityClassName($entityPostfix, $namespacesIndex, $id);

        $this->entityClassNameCache[$id] = $entityClassName;

        return false !== $this->entityClassNameCache[$id];
    }
861566
public function hasVersionMigrated(Version $version)
    {
        $this->createMigrationCollection();

        $record = $this->getCollection()->findOne(['v' => $version->getVersion()]);

        return null !== $record;
    }
641731
protected function getCache($cacheKey)
    {
        $cacheKey = 'combiner.'.$cacheKey;

        if (!Cache::has($cacheKey)) {
            return false;
        }

        return @unserialize(@base64_decode(Cache::get($cacheKey)));
    }
903658
public function isCached($cacheKey)
    {
        // TODO: Refactor for strict types!
        $path = $this->resolvePath($cacheKey, false);
        if (file_exists($path)) {
            return $path;
        } else {
            return false;
        }
    }
1312691
public function has($key)
	{
		$file = $this->path($key);

		if (!file_exists($file))
		{
			return false;
		}

		$data = @unserialize(file_get_contents($file));

		if (!$data)
		{
			throw new RuntimeException('Cache file is invalid.');
		}

		if ($this->isDataExpired($data))
		{
			$this->forget($key);
			return false;
		}

		return true;
	}
831973
public function contentVersion($contentId, $versionNo)
    {
        if ($this->allCleared === true || $this->isSwitchedOff()) {
            return;
        }

        // todo Once we can require 2.2.2+, simplify to just invalidate "content-{$contentId}-version-{$versionNo}"
        $this->cache->deleteItem("ez-content-version-info-${contentId}-${versionNo}");
        $this->cache->invalidateTags(["content-${contentId}-version-list", "content-{$contentId}-version-{$versionNo}"]);
    }
57626
public function getItem($key)
    {
        if (!$this->isValidEntryIdentifier($key)) {
            throw new InvalidArgumentException('"' . $key . '" is not a valid cache entry identifier.', 1514738649629);
        }

        $rawResult = $this->backend->get($key);
        if ($rawResult === false) {
            return new CacheItem($key, false);
        }

        $value = unserialize($rawResult);
        return new CacheItem($key, true, $value);
    }
51155
public function getItem($cacheId, & $success = null)
    {
        $cacheId = $this->normalizeKey($cacheId);

        try {
            $success = true;

            return unserialize($this->cache->restore($cacheId, true));
        } catch (ezcBaseException $ex) {
            $success = false;

            return null;
        }
    }
126359
public function getItem($cacheId, $withVersion = true, &$success = null)
    {
        if ($withVersion) {
            $cacheId .= '.' . $this->getVersion();
        }

        if (!$this->cache->hasItem($cacheId)) {
            $success = false;

            return null;
        }

        $success = null;
        $data    = $this->cache->getItem($cacheId, $success);

        if (!$success) {
            $success = false;

            return null;
        }

        if (!property_exists($data, 'content')) {
            $success = false;

            return null;
        }

        $success = true;

        return $data->content;
    }
762543
public function isExist($cacheName, $cacheDir = false)
    {
        $cacheDir = $cacheDir == false ? self::$cacheDir : $cacheDir;
        $dir = $cacheDir."/".$cacheName;

        return file_exists($dir);
    }
556622
public function version($versionId, $reset = false)
    {
        $versions = $this->versions($reset);
        if (empty($versions[$versionId])) {
            return null;
        }

        return $versions[$versionId];
    }