Smile\ElasticsuiteCore\Helper\Cache::loadCache PHP Method

loadCache() public method

Load data from the cache
public loadCache ( string $cacheKey ) : mixed
$cacheKey string Cache key.
return mixed
    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];
    }

Usage Example

Example #1
0
 /**
  * {@inheritDoc}
  */
 public function getSpellingType(RequestInterface $request)
 {
     $cacheKey = $this->getCacheKey($request);
     $spellingType = $this->cacheHelper->loadCache($cacheKey);
     if ($spellingType === false) {
         $spellingType = $this->loadSpellingType($request);
         $this->cacheHelper->saveCache($cacheKey, $spellingType, [$request->getIndex()]);
     }
     return $spellingType;
 }
All Usage Examples Of Smile\ElasticsuiteCore\Helper\Cache::loadCache