Class QueryCacher
Handles caching queries and loading results from the cache.
Used by Cake\Datasource\QueryTrait internally.
Property Summary
Method Summary
- 
          __construct() publicConstructor. 
- 
          _resolveCacher() protectedGet the cache engine. 
- 
          _resolveKey() protectedGet/generate the cache key. 
- 
          fetch() publicLoad the cached results from the cache or run the query. 
- 
          store() publicStore the result set into the cache. 
Method Detail
__construct() ¶ public
__construct(string|Closure $key, string|Cake\Cache\CacheEngine $config)Constructor.
Parameters
- 
                string|Closure$key
- The key or function to generate a key. 
- 
                string|Cake\Cache\CacheEngine$config
- The cache config name or cache engine instance. 
Throws
RuntimeException_resolveCacher() ¶ protected
_resolveCacher(): Cake\Cache\CacheEngineGet the cache engine.
Returns
Cake\Cache\CacheEngine_resolveKey() ¶ protected
_resolveKey(object $query): stringGet/generate the cache key.
Parameters
- 
                object$query
- The query to generate a key for. 
Returns
stringThrows
RuntimeExceptionfetch() ¶ public
fetch(object $query): Cake\ORM\ResultSet|nullLoad the cached results from the cache or run the query.
Parameters
- 
                object$query
- The query the cache read is for. 
Returns
Cake\ORM\ResultSet|nullEither the cached results or null.
store() ¶ public
store(object $query, Traversable $results): boolStore the result set into the cache.
Parameters
- 
                object$query
- The query the cache read is for. 
- 
                Traversable$results
- The result set to store. 
Returns
boolTrue if the data was successfully cached, false on failure
