请教一下各位有没有碰到过phalcon的文件cache不起作用的情况
cache配置如下:
$di->set('cache',function () use ($config){
$frontCache = new Phalcon\Cache\Frontend\Data(array(
"lifetime" => 3600
));
$cacheDir = $config->application->cacheDir.Time::local_date('Ym').'/'.Time::local_date('Ymd').'/';
if (!file_exists($cacheDir)) {
mkdir($cacheDir,0777,true);
}
/**
* 文件缓存
*/
$cache = new Phalcon\Cache\Backend\File($frontCache, array(
'prefix' => $config->cachePrefix,
"cacheDir" => $cacheDir,
));
return $cache;
});
设置cache如下(在controllers里面):
$this->cache->save('hello',array('1'=>3,'ab'=>'cd'),30);
结果我在使用如下获取cache的时候,一直可以拿得到
$this->cache->get('hello');
请问各位有碰到过么?或者是我哪里理解错了?
取的时候,也需要传缓存周期:
具体可参考我写的PhalconCMS开源代码:链接描述