memcached

when i tried to use CMemCache class with useMemcached=true

my code something like:


$cac->setValue($mykey, $myvar, $exp);

i got the following error:


PHP Error

Description


Memcached::set() expects at most 3 parameters, 4 given


00158:      * @param string the key identifying the value to be cached

00159:      * @param string the value to be cached

00160:      * @param integer the number of seconds in which the cached value will expire. 0 means never expire.

00161:      * @return boolean true if the value is successfully stored into cache, false otherwise

00162:      */

00163:     protected function setValue($key,$value,$expire)

00164:     {

00165:         if($expire>0)

00166:             $expire+=time();

00167:         else

00168:             $expire=0;

00169: 

00170: return $this->_cache->set($key,$value,0,$expire);

00171:     }

i think the 0 before the $expire not needed.

im little confused

i think i need help on this

i defined cache server in main config

then

if i use something like


$cac = new CMemCache

...

$cac->set("mykey", $myvar, $exp);

no problem

but if i use


Yii::app()->cache->set("mykey", $myvar, $exp);

i got the error in previous post

This is a bug. Could you please submit a google ticket (http://code.google.com/p/yii/issues/list) for this? Thanks!

thanks qiang!

it has giving me an headache for last hour :)