getItem() public method

public getItem ( string $key ) : Cache\Taggable\TaggableItemInterface
$key string
return Cache\Taggable\TaggableItemInterface
Ejemplo n.º 1
0
 public function getCachedPaginatorResult(Query $query, CacheOptions $options) : array
 {
     $hash = $this->getHash($query);
     $item = $this->cachePool->getItem($hash);
     if ($item->isHit()) {
         $result = $item->get();
     } else {
         $result = $query->getArrayResult();
         $item->set($result)->setTags($options->getTags());
         $item->expiresAfter($options->getTtl());
         $this->cachePool->save($item);
     }
     return $result;
 }