Allows to read to chained backend adapters 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", "port" => "11211" )), new FileCache($slowFrontend, array( "prefix" => 'cache', "cacheDir" => "../app/cache/" )) )); //Save, saves in every backend $cache->save('my-key', $data);
Phalcon\Cache\Multiple constructor
Adds a backend
Returns a cached content reading the internal backends
Starts every backend
Stores cached content into all backends and stops the frontend
Deletes a value from each backend
Checks if cache exists in at least one backend
Flush all backend(s)
© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/latest/api/Phalcon_Cache_Multiple.html