Description:
Return a range of members in a sorted set, by index.
Syntax:
redis_zrange(key,start,stop[,withscores])
Note:
This external library function returns members along with their scores if the parameter withscores is supplied; return members only without the parameter.
By default the returned members is in a ascending order; use @z option to arrange them in a descending order. Arrange members with the same score by lexicographical range.
Both index parameters start and stop start from 0. That is to say, 0 represents the first member in the list, 1 the second member, and so on. The indexes can also be negative. -1 represents the last member in the list, -2 the second-to-last member, and so on.
Options:
@z Arrange members in a descending order.
Parameters:
con |
Database connection string |
start |
Starting index |
stop |
Ending index |
withscores |
Also return the scores; can be omitted. |
Return value:
A table sequence containing a range of members of the sorted set, by index.
Example:
|
A |
|
1 |
=redis("192.168.18.131:6379","runqian") |
|
2 |
=redis_zrange(A1,"page_rank",0,2) |
|
3 |
=redis_zrange@z(A1,"page_rank",0,2,"WITHSCORES") |
|
4 |
=redis_zrange@z(A1,"page_rank",-2,-1,"WITHSCORES") |
|