1

I use phpredis extension, and when I call:

redis.call("ZREVRANGE", KEYS[1], start, endPos, 'WITHSCORES')

in lua script, it returns

array(6) {
[0] =>
string(5) "10010"
[1] =>
string(2) "12"
[2] =>
string(5) "10012"
[3] =>
string(2) "-2"
[4] =>
string(5) "10011"
[5] =>
string(2) "-2"
}

actually I want to return associative array:

array(
"10010" => 12, "10012 => -2, ...
)
Kamiccolo
  • 7,758
  • 3
  • 34
  • 47
Devin
  • 33
  • 5

1 Answers1

0

I have implemented the same thing using PREDIS and it returns exactly the way you want it to. You might want to try that..

include 'Autoloader.php';

Autoloader::register();

$redis = new Predis\Client(array(
    "scheme" => "tcp",
    "host" => localhost,
    "port" => 6379,
));

$scores = $redis->zrevrange('key','start','end',withscores);
Kamiccolo
  • 7,758
  • 3
  • 34
  • 47
Akshat Goel
  • 736
  • 2
  • 6
  • 19
  • I'm running lua scipt on redis server with phpredis extension, not just using a redis extension to get data from zset. – Devin Sep 25 '13 at 05:57