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.
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 caching.
There are 5 built-in caching engines:
FileEngine - Uses simple files to store content. Poor performance, but good for
storing large objects, or things that are not IO sensitive. Well suited to development
as it is an easy cache to inspect and manually flush.ApcEngine - Uses the APC object cache, one of the fastest caching engines.MemcacheEngine - Uses the PECL::Memcache extension and Memcached for storage.
Fast reads/writes, and benefits from memcache being distributed.XcacheEngine - Uses the Xcache extension, an alternative to APC.WincacheEngine - Uses Windows Cache Extension for PHP. Supports wincache 1.1.0 and higher.
This engine is recommended to people deploying on windows with IIS.RedisEngine - Uses redis and php-redis extension to store cache data.See Cache engine documentation for expected configuration keys.
Storage engine for CakePHP caching
An object registry for cache engines.
Used by Cake\Cache\Cache to load and manage cache engines.