saveCache() public method

Save some data into an index cache.
public saveCache ( string $cacheKey, mixed $data, string[] $cacheTags, integer $lifetime = self::DEFAULT_LIFETIME )
$cacheKey string Cache key.
$data mixed Data.
$cacheTags string[] Cache tags.
$lifetime integer Cache lifetime.
Esempio n. 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;
 }
Esempio n. 2
0
 /**
  * Provides weigthed rewrites for the query.
  *
  * @param ContainerConfigurationInterface $containerConfig Search request container config.
  * @param string                          $queryText       Fulltext query.
  *
  * @return array
  */
 public function getQueryRewrites(ContainerConfigurationInterface $containerConfig, $queryText)
 {
     $cacheKey = $this->getCacheKey($containerConfig, $queryText);
     $cacheTags = $this->getCacheTags($containerConfig);
     $queryRewrites = $this->cacheHelper->loadCache($cacheKey);
     if ($queryRewrites === false) {
         $queryRewrites = $this->computeQueryRewrites($containerConfig, $queryText);
         $this->cacheHelper->saveCache($cacheKey, $queryRewrites, $cacheTags);
     }
     return $queryRewrites;
 }