public function lookup(Query $query)
    {
        $id = $this->serializeQueryToIdentity($query);

        $expiredAt = $this->expiredAt;

        return $this->cache
            ->get($id)
            ->then(function ($value) use ($query, $expiredAt) {
                // cache 0.5+ resolves with null on cache miss, return explicit cache miss here
                if ($value === null) {
                    return Promise\reject();
                }

                /* @var $recordBag RecordBag */
                $recordBag = unserialize($value);

                // reject this cache hit if the query was started before the time we expired the cache?
                // todo: this is a legacy left over, this value is never actually set, so this never applies.
                // todo: this should probably validate the cache time instead.
                if (null !== $expiredAt && $expiredAt <= $query->currentTime) {
                    return Promise\reject();
                }

                return $recordBag->all();
            });
    }
public function lookup(Query $query)
    {
        $id = $this->serializeQueryToIdentity($query);

        $expiredAt = $this->expiredAt;

        return $this->cache
            ->get($id)
            ->then(function ($value) use ($query, $expiredAt) {
                // cache 0.5+ resolves with null on cache miss, return explicit cache miss here
                if ($value === null) {
                    return Promise\reject();
                }

                /* @var $recordBag RecordBag */
                $recordBag = unserialize($value);

                // reject this cache hit if the query was started before the time we expired the cache?
                // todo: this is a legacy left over, this value is never actually set, so this never applies.
                // todo: this should probably validate the cache time instead.
                if (null !== $expiredAt && $expiredAt <= $query->currentTime) {
                    return Promise\reject();
                }

                return $recordBag->all();
            });
    }
public function lookup ( Query $ query ) { $ id = $ this -> serializeQueryToIdentity ( $ query ) ; $ expiredAt = $ this -> expiredAt ; return $ this -> cache -> get ( $ id ) -> then ( function ( $ value ) use ( $ query , $ expiredAt ) { // cache 0.5+ resolves with null on cache miss, return explicit cache miss here if ( $ value === null ) { return Promise \ reject ( ) ; } /* @var $recordBag RecordBag */ $ recordBag = unserialize ( $ value ) ; // reject this cache hit if the query was started before the time we expired the cache? // todo: this is a legacy left over, this value is never actually set, so this never applies. // todo: this should probably validate the cache time instead. if ( null !== $ expiredAt && $ expiredAt <= $ query -> currentTime ) { return Promise \ reject ( ) ; } return $ recordBag -> all ( ) ; } ) ; }
Looks up the cache if there's a cached answer for the given query

@param Query $query
@return PromiseInterface Promise<Record[],mixed> resolves with array of Record objects on sucess
or rejects with mixed values when query is not cached already.
Looks up the cache if there s a cached answer for the given query