Hi.
Mget operation does not work.
Doing so:
$cache=Yii::app()->cache;
$tmp=array('test1','test2');
$mas=$cache->get($tmp);
print_r($mas);
Array([test1]=>,[test2]=>)
Gives empty answers
But separately is getting all right.
Hi.
Mget operation does not work.
Doing so:
$cache=Yii::app()->cache;
$tmp=array('test1','test2');
$mas=$cache->get($tmp);
print_r($mas);
Array([test1]=>,[test2]=>)
Gives empty answers
But separately is getting all right.
just a performance test (using servers in localhost)
APC
========
10000 single integer write : 0.028426885604858 seconds
REDIS
========
10000 single integer write : 6.9566950798035 seconds
MEMCACHE
========
10000 single integer write : 3.1675958633423 seconds
is this using my updated version or the original one ?
and can we compare to different redis implementations like this one
would you post the script you use to benchmark here https://gist.github.com/
I’m using your version, without any modifications.
The script is a simple sequence of for using ‘get’ or ‘set’.
this my benchmark code
10,000 set of simple key and simple string value (I’ve also tried integer value of 10)
./protected/cmdrun cache benchmark
YiiRedis delta 1.1029698848724
Predis delta 1.7682290077209
[alsadi@localhost muayyad-appii]$
Argh !! I’ll try to use ->getClient to directly access redis… thanks for this benchmark
getClient is for the YiiRedis not PRedis
Hi Gustavo and Muayyad,
thanks for the great extension. I’m only having some issues with addValue(), which I’m using to implement exclusive locks for an application of mine. It looks like there’s some typo in the method, namely the $time variable which is not initialized anywhere. I will fix it in my copy, but I guess it would be better if you fixed it in your distribution as well.
protected function addValue($key,$value,$expire)
{
if($expire>0){
if($this->_cache->setnx($key,$time,$value))
return $this->_cache->expire($key,$time);
return false;
}else
return $this->_cache->setnx($key,$value);
}
Hi all,
I’m using CRedisCache with redis server 2.6.13 and getting stuck with mget function… It seems to me that the mget function of CCache.php does not work properly. Below is what I did
set
function to save to cache my objects under array format like this:
Yii::app()->cache->{'set'}($key, $value); // $key is an integer, $value is an array
mget
on passing a list of keys to get the corresponding objects, but it return an error like below:
PHP notice
Undefined offset: 0
/Users/NguyenTuanQuyen/Sites/cms/core/cms/extensions/redis/Predis/Network/StreamConnection.php(280)
268 */
269 public function writeCommand(ICommand $command)
270 {
271 $commandId = $command->getId();
272 $arguments = $command->getArguments();
273
274 $cmdlen = strlen($commandId);
275 $reqlen = count($arguments) + 1;
276
277 $buffer = "*{$reqlen}\r\n\${$cmdlen}\r\n{$commandId}\r\n";
278
279 for ($i = 0; $i < $reqlen - 1; $i++) {
[b]280 $argument = $arguments[$i];[/b]
281 $arglen = strlen($argument);
282 $buffer .= "\${$arglen}\r\n{$argument}\r\n";
283 }
292 {
....
multi & exec
with
get
but it doesn’t work either. There’s an error like:
unserialize(): Error at offset 0 of 6 bytes
Stack Trace
#0
+ /Users/NguyenTuanQuyen/Sites/cms/core/yii/framework/caching/CCache.php(108): unserialize("QUEUED")
#1
– /Users/NguyenTuanQuyen/Sites/thethao/common/components/RedisCacheHelper.php(27): CCache->get("63")
22 const MAX_ARTICLE_PER_TERM = 500;
23
24 const PREFIX_HASH_KEY = 'hv_';
25
26 public static function get($key) {
27 return Yii::app()->cache->{'get'}($key);
28 }
29
Thanks a million for helping me!