src/Search/Search.php
private function _doExecuteCached(Query $query)
    {
        if (null !== $resultCache = $this->documentManager->getResultCache()) {
            $item = $resultCache->getItem($this->cacheProfile->getCacheKey());

            if ($item->isHit()) {
                yield from $item->get();

                return;
            }
        }

        $resultSets = iterator_to_array($this->_doExecute($query));

        if (isset($item)) {
            $item->set($resultSets);
            $item->expiresAfter($this->cacheProfile->getTtl());
            $resultCache->save($item);
        }

        yield from $resultSets;
    }
private function _doExecuteCached(Query $query)
    {
        if (null !== $resultCache = $this->documentManager->getResultCache()) {
            $item = $resultCache->getItem($this->cacheProfile->getCacheKey());

            if ($item->isHit()) {
                yield from $item->get();

                return;
            }
        }

        $resultSets = iterator_to_array($this->_doExecute($query));

        if (isset($item)) {
            $item->set($resultSets);
            $item->expiresAfter($this->cacheProfile->getTtl());
            $resultCache->save($item);
        }

        yield from $resultSets;
    }
private function _doExecuteCached ( Query $ query ) { if ( null !== $ resultCache = $ this -> documentManager -> getResultCache ( ) ) { $ item = $ resultCache -> getItem ( $ this -> cacheProfile -> getCacheKey ( ) ) ; if ( $ item -> isHit ( ) ) { yield from $ item -> get ( ) ; return ; } } $ resultSets = iterator_to_array ( $ this -> _doExecute ( $ query ) ) ; if ( isset ( $ item ) ) { $ item -> set ( $ resultSets ) ; $ item -> expiresAfter ( $ this -> cacheProfile -> getTtl ( ) ) ; $ resultCache -> save ( $ item ) ; } yield from $ resultSets ; }
Executes a cached query.

@param Query $query

@return \Generator|ResultSet[]
Executes a cached query .