/** * {@inheritdoc} */ public function getResult(QueryBuilder $builder, DataSetRequestInterface $request, ColumnCollection $columns, CacheOptions $cache) { $query = $builder->getQuery(); $query->useQueryCache($this->options['cache']); $query->useResultCache(false); if ($cache->isEnabled()) { $result = $this->cacheManager->getCachedDataSetResult($query, $cache); } else { $result = $query->getArrayResult(); } return $this->transformResult($result); }
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; }