2009年9月12日星期六

Re: [fw-mvc] zend_cache problem....

Op Saturday 12 September 2009 22:50:09 schreef sina miandashti:
> i wrote this code ....
>
> index.php
>
> /*
> * caching stuff ...
> */
> $frontend = array (lifetime => 1, automatic_seralization => false );
> $backend = array ('cache_dir' => APPLICATION_PATH . '/cache/data/' );
> $cache = Zend_Cache::factory('Core','File',$frontend,$backend);
> Zend_Registry::set ( 'cache', $cache );
> //end cache
>
>
> in controller file
>
> $sina = array('1','2');
> serialize($sina);
> $this->cache->automatic_serialization = true;
> $this->cache->save($sina,'users');
>
>
> but it throws this exception
>
> Exception information:
>
> Message:Datas must be string or set automatic_serialization = true
>
> why?


Hi Sina,


automatic_serialization is an option for Zend_Cache. So just setting the property won't work. Try Zend_Cache::setOptions($name,$value), so in your case:
$this->cache->setOption('automatic_serialization', true);
That should work.


Regards, Jurian
--
Jurian Sluiman
Soflomo.com

没有评论: