hackpar / redis

Automatically exported from code.google.com/p/redis
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

ZRANKBYSCORE #516

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What version of Redis you are using, in what kind of Operating System?
Redis 2.2.4 in CentOS 5.5
What is the problem you are experiencing?
Need command ZRANKBYSCORE
What steps will reproduce the problem?
N/A
Do you have an INFO output? Please past it here.
N/A

Sometimes I need to know the rank for special member (I know its score but not 
its value).
like
ZRANKBYSCORE key score
I then store the returned rank as $lastrank
Then I probably issue a ZRANGE after that, like
ZRANGE key $lastrank $lastrank+200

should be very handy :)
thank.

Original issue reported on code.google.com by wumengye@gmail.com on 9 Apr 2011 at 7:01

GoogleCodeExporter commented 8 years ago
If you are okay with 2 round trips, you can use zrangebyscore to get the 
member, then fetch the rank of the member.

Original comment by josiah.c...@gmail.com on 9 Apr 2011 at 7:15