Cache (class)
Class Cache
Cache provides a consistent interface to Caching in your application. It allows you to use several different Cache engines, without coupling your application to a specific implementation. It also allows you to change out cache storage or configuration without effecting the rest of your application.
Configuring Cache engines
You can configure Cache engines in your application's Config/cache.php
file. A sample configuration would be:
Cache::config('shared', [ 'className' => 'Cake\Cache\Engine\ApcEngine', 'prefix' => 'my_app_' ]);
This would configure an APC cache engine to the 'shared' alias. You could then read and write to that cache alias by using it for the $config
parameter in the various Cache methods.
In general all Cache operations are supported by all cache engines. However, Cache::increment() and Cache::decrement() are not supported by File