Cache\Backend\Memcache

Class Phalcon\Cache\Backend\Memcache

extends abstract class Phalcon\Cache\Backend

implements Phalcon\Cache\BackendInterface

Allows to cache output fragments, PHP data or raw data to a memcache backend This adapter uses the special memcached key “_PHCM” to store all the keys internally used by the adapter

// Cache data for 2 days
 $frontCache = new Phalcon\Cache\Frontend\Data(array(
    "lifetime" => 172800
 ));

 //Create the Cache setting memcached connection options
 $cache = new Phalcon\Cache\Backend\Memcache($frontCache, array(
    'host' => 'localhost',
    'port' => 11211,
    'persistent' => false
 ));

 //Cache arbitrary data
 $cache->save('my-data', array(1, 2