Load data from the cache

@param string $cacheKey Cache key.

@return mixed
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];
    }
659195
protected function getCached(string $playerName, string $cacheKey)
    {
        $playerCacheKey = strtolower($playerName);

        if (!isset($this->cache[$cacheKey][$playerCacheKey])) {
            return null;
        }

        return $this->cache[$cacheKey][$playerCacheKey];
    }
521752
public function get(CacheKey $key) {

		if (!empty($this->elements[$key->getModule()] [$key->getProperty()])) {
            /** @noinspection PhpUndefinedMethodInspection */
            $tValue = $this->elements[$key->getModule()] [$key->getProperty()]->getValue ();
			return $tValue;
		} else {
			return false;
		}
	}
1217973
public function get($key)
    {
        $cache_data = $this->getItem($key);
        if ($cache_data === false || !is_array($cache_data)) {
            return false;
        }

        return $cache_data['data'];
    }
1254999
public function load(Cache $cache, $cacheId)
    {
        if ($cache->contains($cacheId)) {

            /**
             * Cache contains gearman structure
             */
            $this->workerCollection = $cache->fetch($cacheId);

        } else {

            /**
             * Cache is empty.
             *
             * Full structure must be generated and cached
             */
            $this->workerCollection = $this
                ->getGearmanParser()
                ->load()
                ->toArray();

            $cache->save($cacheId, $this->workerCollection);
        }

        return $this;
    }
278611
protected function loadRef($key)
    {
        $attrs = $this->getAttrs();
        $reference = $attrs[$key];
        $cache = &$this->_cache;
        if (isset($this->cleanData[$key])) {
            $value = $this->cleanData[$key];
        } else {
            $value = null;
        }

        $model = $reference['model'];
        $type = $reference['type'];
        if ( isset($cache[$key]) ) {
            $obj = &$cache[$key];

            return $obj;
        } else {
            if (class_exists($model)) {
                if ($type == self::DATA_TYPE_REFERENCE) {
                    if (\MongoDBRef::isRef($value)) {
                        $object = $model::id($value['$id']);
                        $cache[$key] = $object;

                        return $object;
                    }

                    return null;
                } elseif ($type == self::DATA_TYPE_REFERENCES) {
                    $res = array();
                    if (!empty($value)) {
                        foreach ($value as $item) {
                            if(isset($item['$id'], $item['$ref'])) {
                                $record = $model::id($item['$id']);
                                if ($record) {
                                    $res[] = $record;
                                }
                            }
                        }
                    }
                    $set =  Collection::make($res);
                    $cache[$key] = $set;
                    $obj = &$cache[$key];

                    return $obj;
                }
            }
        }
    }
721940
public function getCache($key) {
        if($this->modified === true || !$this->cacheEnabled) {return false;}
        else{
            $this->cacheValue = $this->cacheObj->fetch($key);
            return $this->cacheValue;
        }
    }
349924
public function read($key)
    {
        if (!isset($this->cacheDirectory)) {
            return;
        }

        $this->loadCacheMetaData();

        return unserialize(file_get_contents($this->cacheDirectory . '/' . $key));
    }
870837
public function getFromCache($key)
  {
    $value = $this->memcache->get($this->buildMKey($key));
    if ($value) {
      return unserialize($value);
    }
    return null;
  }
523326
function load($key): bool {
    $cacheKey = [__CLASS__, $key];
    $viewRenderer = $this->viewRenderer;

    /** @var \yii\caching\Cache $cache */
    $cache = $viewRenderer->cache;
    if (!$viewRenderer->enableCaching || !$cache->exists($cacheKey)) return false;

    eval("?>{$cache->get($cacheKey)}");
    return true;
  }
389971
public function getCache($key) {
        if (!$this->__cacheEnabled) {
            return null;
        }

        $key = $this->createCacheKey($key);

        if ($this->hasCache($key)) {
            return $this->_cache[$key];
        }

        return null;
    }
425619
public function find($cacheKey)
    {
        $key = array_search($cacheKey, $this->cachedKeys);

        if ($key != false and ! $this->cache->has($key))
        {
            unset($this->cachedKeys[$key]);
            $this->storeCachedKeys();

            return false;
        }

        return $key ? $this->cache->get($key) : false;
    }
521143
public function get(CacheKey $key) {

		if (isset ( $this->cache [$key->getModule()] [$key->getProperty()] )) {
			return $this->cache [$key->getModule()] [$key->getProperty()];
		} else {
			return false;
		}
	}
745407
public function retrieve($key)
    {
        $key = (string)$key;
        if ($cache = $this->loadCache()) {
            if (isset($cache[$key])) {
                if (!$this->isExpired($cache[$key]['time'], $cache[$key]['expire'])) {
                    return unserialize($cache[$key]['data']);
                }
            }
        }
        return null;
    }
273606
public function get( $key )
    {
        $cache_file = new File($key.self::CACHE_FILE_EXT, $this->config->getCacheRoot());
    
        if (!$cache_file->exists()){
            return false;
        }
        if (!$cache_file->canRead()){
            throw( new CacheFileNotReadableException($cache_file) );
        }
        
        $lines = $cache_file->getContentsAsArray();
        
        static $keywords = [
            'expires', 'type', 'class', 'data'
        ];
        
        $cache_info =[];
        foreach($keywords as $keyword)
        {
            $line = array_shift($lines);
            $kwlen = strlen($keyword);
            
            if (!$line){
                throw( new CacheFileFormatException($cache_file) );
            }
            if (strlen($line) < $kwlen+1 || strpos($line,$keyword.':') !== 0){
                throw( new CacheFileFormatException($cache_file) );
            }
            $cache_info[$keyword] = substr($line,$kwlen+1);
        }
    
        // check expire date
        $expires = $cache_info['expires'] ? intval($cache_info['expires']) : null;
        if ($expires === null){
            throw( new CacheMetaDataException('expires',$expires) );
        }
        $now = time();
        if ($expires > 0 && $expires < $now){
            return null;
        }
        
        // decode data
        $data = $cache_info['data'] ?? null;
        if ($data === null){
            throw( new CacheMetaDataException('data',$data) );
        }
        $data = unserialize(base64_decode($data));
    
        // type check
        $type = $cache_info['type'] ?? null;
        if ($type === null){
            throw( new CacheMetaDataException('type',$type) );
        }
        if ($type !== gettype($data)){
            return null;
        }
    
        // class check
        if ($type === 'object'){
            $class = $cache_info['class'] ?? null;
            if ($class === null){
                throw( new CacheMetaDataException('class',$class) );
            }
            if (!($data instanceof $class)){
                return null;
            }
        }
    
        return $data;
    }
1029468
public function getItem($key)
    {
        $this->validateKey($key);

        if ($this->hasItem($key)) {
            $data = file_get_contents($this->getPath($key));
            if ($data !== false) {
                $item = unserialize($data, [
                    "allowed_classes" => true,
                ]);

                if (!$item instanceof CacheItemInterface) {
                    throw new CacheException("Unexpected object during deserialization: " . get_class($item));
                }

                return $item;
            }
        }

        # If we didn't find a suitable item then create a new one now
        return new Item($key);
    }
793466
private function fetch($key)
    {

        if ($this->cache->hasKey($key)) {
            return $this->cache->get($key);
        }

        $row = $this->database->table($this->config['db_table'])->where('setting_key', $key)->first(['setting_value']);

        return (!is_null($row)) ? $this->cache->set($key, unserialize($row->setting_value)) : null;
    }