Cache\Backend\Memory

Class Phalcon\Cache\Backend\Memory

extends abstract class Phalcon\Cache\Backend

implements Phalcon\Cache\BackendInterface

Stores content in memory. Data is lost when the request is finished

//Cache data
$frontCache = new Phalcon\Cache\Frontend\Data();

  $cache = new Phalcon\Cache\Backend\Memory($frontCache);

//Cache arbitrary data
$cache->save('my-data', array(1, 2, 3, 4, 5));

//Get data
$data = $cache->get('my-data');

Methods

public mixed get (string $keyName, [long $lifetime])

Returns a cached content

public 登录查看完整内容