开发者

Zend_Cache - "Datas must be string or set automatic_serialization = true"

开发者 https://www.devze.com 2022-12-19 12:30 出处:网络
I am trying to cache an array with Zend_Cache like this: $cache = Zend_Registry::get(\'cache\'); // $data is an array

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号