I am trying to cache an array with Zend_Cache like this:
$cache = Zend_Registry::get('cache');
// $data is an array
$cache->save($data, 'externalData');
And I am getting this error:
Message: Datas must be string or set automatic_serialization = true
Even though the automatic_serialization is set tu true when initializing Zend_Cache in the bootstrap file:
protected function _initCache()
{
$frontend= array('lifetime' => 7200,
开发者_JS百科 'automatic_seralization' => true);
$backend= array('cache_dir' => 'cache');
$this->cache = Zend_Cache::factory('core',
'File',
$frontend,
$backend);
}
What could cause this error message?
Maybe you just made a copy-paste error or a typo error, but, in the code you posted, you have :
$frontend= array('lifetime' => 7200,
'automatic_seralization' => true);
i.e. you are setting automatic_seralization
to true, and not automatic_serialization
: note the i in ser-i-alization.
精彩评论