Handles caching queries and loading results from the cache.
Used by {@link \Cake\Datasource\QueryTrait} internally.
Constructor.
Get the cache engine.
Get/generate the cache key.
Load the cached results from the cache or run the query.
Store the result set into the cache.
__construct(Closure|string $key, Psr\SimpleCache\CacheInterface|string $config)
Constructor.
Closure|string
$key The key or function to generate a key.
Psr\SimpleCache\CacheInterface|string
$config The cache config name or cache engine instance.
RuntimeException
_resolveCacher(): Psr\SimpleCache\CacheInterface
Get the cache engine.
Psr\SimpleCache\CacheInterface
_resolveKey(object $query): string
Get/generate the cache key.
object
$query The query to generate a key for.
string
RuntimeException
fetch(object $query): mixed|null
Load the cached results from the cache or run the query.
object
$query The query the cache read is for.
mixed|null
store(object $query, Traversable $results): bool
Store the result set into the cache.
object
$query The query the cache read is for.
Traversable
$results The result set to store.
bool
Config for cache engine.
Psr\SimpleCache\CacheInterface|string
The key or function to generate a key.
Closure|string
© 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.4/class-Cake.Datasource.QueryCacher.html