Handles caching queries and loading results from the cache.
Used by Cake\Datasource\QueryTrait internally.
__construct(mixed $key, mixed $config)
Constructor.
string|\Closure
$key The key or function to generate a key.
string|\Psr\SimpleCache\CacheInterface
$config The cache config name or cache engine instance.
RuntimeException
_resolveCacher()
Get the cache engine.
\Psr\SimpleCache\CacheInterface
_resolveKey(object $query)
Get/generate the cache key.
object
$query The query to generate a key for.
string
RuntimeException
fetch(object $query)
Load the cached results from the cache or run the query.
object
$query The query the cache read is for.
mixed|null
Either the cached results or null.
store(object $query, \Traversable $results)
Store the result set into the cache.
object
$query The query the cache read is for.
\Traversable
$results The result set to store.
bool
True if the data was successfully cached, false on failure
Config for cache engine.
string|\Psr\SimpleCache\CacheInterface
The key or function to generate a key.
string|\Closure
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.Datasource.QueryCacher.html