The Cache layer of Lithium inherits from the common Adaptable class, which provides the generic
configuration setting & retrieval logic, as well as the logic required to locate & instantiate
the proper adapter class.
In most cases, you will configure various named cache configurations in your bootstrap process,
which will then be available to you in all other parts of your application.
A simple example configuration:
{{{Cache::config(array(
'local' => array('adapter' => 'Apc'),
'distributed' => array(
'adapter' => 'Memcached',
'host' => '127.0.0.1:11211',
),
'default' => array('adapter' => 'File')
));}}}
Each adapter provides a consistent interface for the basic cache operations of write, read,
delete and clear, which can be used interchangeably between all adapters. Some adapters
may provide additional methods that are not consistently available across other adapters.
To make use of these, it is always possible to call:
{{{Cache::adapter('named-configuration')->methodName($argument);}}}
This allows a very wide range of flexibility, at the cost of portability.
Some cache adapters (e.g. File) do _not_ provide the functionality for increment/decrement.
Additionally, some cache adapters support multi-key operations for write, read and delete
— please see the individual documentation for cache adapters and the operations that they support.