Cache\Multiple

Class Phalcon\Cache\Multiple

Allows to read to chained backends writing to multiple backends

use Phalcon\Cache\Frontend\Data as DataFrontend,
       Phalcon\Cache\Multiple,
       Phalcon\Cache\Backend\Apc as ApcCache,
       Phalcon\Cache\Backend\Memcache as MemcacheCache,
       Phalcon\Cache\Backend\File as FileCache;

   $ultraFastFrontend = new DataFrontend(array(
       "lifetime" => 3600
   ));

   $fastFrontend = new DataFrontend(array(
       "lifetime" => 86400
   ));

   $slowFrontend = new DataFrontend(array(
       "lifetime" => 604800
   ));

   //Backends are registered from the fastest to the slower
   $cache = new Multiple(array(
       new ApcCache($ultraFastFrontend, array(
           "prefix" => 'cache',
       )),
       new MemcacheCache($fastFrontend, array(
           "prefix" => 'cache',
           "host" => "localhost",