2009年12月21日星期一

[fw-mvc] Zend Cache Apc troubles

Hi.
I don't understand why this works with File
doesn't work with with Apc
protected function _initCache()
{
$dir = Zend_Registry::get('dir');
$frontendOptions = array(
'caching'=> true,
'cache_id_prefix' => null,
'lifetime' => 7200,
'logging' => false,
'write_control'=> true,
'automatic_serialization' => true,
'automatic_cleaning_factor' => 10,
'ignore_user_abort'=> false,
);
$backendOptions = array(
'cache_dir' => $dir->cache
);
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions,
$backendOptions);
//$cache = Zend_Cache::factory('Core', 'Apc', $frontendOptions);
Zend_Registry::set('cache', $cache);

}

In the model
public function fetchItems($lang)
{
$cache = Zend_Registry::get('cache');
if(!$data = $cache->load('RightFetchTags')) {
// do select
$data = $table->fetchAll($select)->toArray();
$cache->save($data, 'RightFetchTags');
}
return $data;
}

Bye
--
View this message in context: http://n4.nabble.com/Zend-Cache-Apc-troubles-tp976493p976493.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: