Reads a file from the cache

@param string $sKey The key of the item

@return Item|null
@throws FactoryException
332823
public function read(string $sKey): ?Item
    {
        return $this->exists($sKey) ? $this->newItem($sKey) : null;
    }
737554
public function read($key)
    {
        $this->_cachedData or $this->_cachedData = Cache::get('model-metadata');
        return isset($this->_cachedData[$key]) ? $this->_cachedData[$key] : null;
    }
166034
public function getList($sKey)
    {
        if (empty($sKey)) {
            return [];
        }

        //Get value from storage
        $arValueList = $this->get($sKey);
        if (empty($arValueList) || !is_array($arValueList)) {
            $arValueList = [];
        }

        return $arValueList;
    }
210896
public function extractText($sKey, $mValue)
    {
        $oCdn = Factory::service('Cdn', 'nails/module-cdn');
        $oObj = $oCdn->getObject($mValue);

        $sOut = $oObj->file->name->human . ' (' . $oObj->file->size->human . ')';
        $sOut .= '<a href="' . cdnServe($oObj->id, true) . '" class="btn btn-xs btn-primary pull-right">Download</a>';

        return $sOut;
    }
832127
protected function load($key) {
        try {
            return $this->memcached->get($key);
        } catch (\Exception $e) {
            throw new StorageException("Failed to load memcached key: $key", 1, $e);
        }
    }
1225991
public function getUrl(string $sKey = null): string
    {
        $sUrl = rtrim($this->sUrl, '/');
        $sUrl .= $sKey ? '/' . $sKey : '';
        return $sUrl;
    }
517972
public function loadCache($cacheKey)
    {
        if (!isset($this->localCache[$cacheKey])) {
            $data = $this->cache->load($cacheKey);

            if ($data) {
                $data = unserialize($data);
            }

            $this->localCache[$cacheKey] = $data;
        }

        return $this->localCache[$cacheKey];
    }
1127101
protected function read($filename)
    {
        $resource = @fopen($filename, 'rb');

        if (!$resource) {
            throw new \RuntimeException(
                sprintf(
                    'Unable to fetch cache entry for %s.  Connot open the resource.',
                    $filename
                )
            );
        }

        // If locking is enabled get a shared lock for reading on the resource.
        if ($this->options['file_locking'] && !flock($resource, LOCK_SH)) {
            throw new \RuntimeException(
                sprintf(
                    'Unable to fetch cache entry for %s.  Connot obtain a lock.',
                    $filename
                )
            );
        }

        $data = stream_get_contents($resource);

        // If locking is enabled release the lock on the resource.
        if ($this->options['file_locking'] && !flock($resource, LOCK_UN)) {
            throw new \RuntimeException(
                sprintf(
                    'Unable to fetch cache entry for %s.  Connot release the lock.',
                    $filename
                )
            );
        }

        fclose($resource);

        return $data;
    }
472044
protected function retrieve($key)
    {
        if (!$this->has($key)) {
            return null;
        }

        $cache = file_get_contents($this->path . $key);

        // compare the timestamp to the current time when we read the file.
        if (time() >= substr($cache, 0, 10)) {
            $this->forget($key);
            return null;
        }

        return unserialize(substr($cache, 10));
    }
63915
public function read($key)
    {
        $cacheFile = $this->getCachePath($key);

        clearstatcache(true, $cacheFile);
        if (file_exists($cacheFile)) {
            $cache = file_get_contents($cacheFile);
            $cache = json_decode($cache, true);
            if ($cache['ttl'] > time()) {
                $this->remainingTtl = $cache['ttl'] - time();
                return $cache['content'];
            } else {
                $this->purge($key);
            }
        }

        return false;
    }
1079768
public function get($key)
	{
		$file = $this->path($key);

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

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

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

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

		return $data['value'];
	}
23244
protected function readFromCache($fileName)
    {
        $cacheFile = $this->getCacheFile($fileName);
        if (file_exists($cacheFile) && is_readable($cacheFile)) {
            include($cacheFile);
            if (isset($crudlexCacheContent)) {
                return $crudlexCacheContent;
            }
        }
        return null;
    }
1289281
public function extractText($sKey, $mValue)
    {
        return array_key_exists($mValue, $this->aLikertTerms) ? $this->aLikertTerms[$mValue] : '';
    }
567001
public function get($key) {
		$data = CacheFactory::getCache()->get($key);
		if ($data && isset($data['__fsm'])) {
			$modelName = empty($data['__fsm']['m']) ? '' : 'App\\Model\\'.ucfirst($data['__fsm']['m']);
			$isArray = intval($data['__fsm']['a']);
			if ($isArray == 1) {
				$ma = new ModelArray();
				foreach ($data['data'] as $item) {
					$model = new $modelName();
					$model->fromArray($item);
					$ma[] = $model;
				}
				$data = $ma;
			} else {
				$model = new $modelName();
				$data = $model->fromArray($data['data']);
			}
		}
		return $data;
	}
1164699
protected static function _checkKey($sKey) {
		if ($sKey === '_id') {
			return FALSE;
		}
		if ($sKey === static::$_mKey) {
			return FALSE;
		}
		if (strpos($sKey, '.') !== FALSE) {
			return FALSE;
		}
		if (substr($sKey, 0, 1) === '$') {
			return FALSE;
		}
		return TRUE;
	}
783923
public function read($key)
	{
		// Get data from memory storage
		$data = $this->memoryStorage->read($key);
		if ($data !== null) {
			return $data;
		}

		// Get data from cached storage and write them to memory storage
		$data = $this->cachedStorage->read($key);
		if ($data !== null) {
			$this->memoryStorage->write($key, $data, []);
		}

		return $data;
	}
1245248
protected function retrieve($key)
        {
            if (!File::exists($this->path . $key)) {
                return null;
            }

            // File based caches store have the expiration timestamp stored in
            // UNIX format prepended to their contents. We'll compare the
            // timestamp to the current time when we read the file.
            if (time() >= substr($cache = fgc($this->path . $key), 0, 10)) {
                return $this->forget($key);
            }

            return unserialize(substr($cache, 10));
        }