Description:
Return a range of members in sorted set, by score.
Syntax:
redis_zrangebyscore(con,key,min,max[,offset,n,withscores])
Note:
This external library function gets members with scores between the given values from the parameter min and the parameter max (min and max are inclusive). The desired members are arranged by score in ascending order (from low to high).
The interval defined by min and max in the expression is by default a closed interval. Use a double quotation and the left parenthesis to represent an open interval, like the expression redis_zrangebyscore(A1,"salary","(5000",40000,"WITHSCORES") which returns a range of members in the sorted set salary with scores between 5000 inclusive and 40000.
The function returns members along with their scores if the parameter withscores is supplied; return members only without the parameter.
Arrange members with the same score by lexicographical range.
Parameters:
con |
Database connection string |
key |
Sorted set name |
min |
The smallest score; can be –inf, meaning infinitely small |
max |
The greatest score; can be +inf, meaning inifinitely large |
offset |
Offset interval; can be omitted along with the parameter n |
n |
Offset value; can be omitted along with the parameter offset |
withscores |
Also return the scores; can be omitted |
Return value:
A table sequence
Example:
|
A |
|
1 |
=redis("192.168.18.131:6379","runqian") |
|
2 |
=redis_zrangebyscore(A1,"salary","-inf","+inf","WITHSCORES") |
|
3 |
=redis_zrangebyscore(A1,"salary","-inf","+inf",0,2,"WITHSCORES") |
|
4 |
=redis_zrangebyscore(A1,"salary",5000,40000,"WITHSCORES") |
|
5 |
=redis_zrangebyscore(A1,"salary","(5000",40000,"WITHSCORES") |
|
6 |
=redis_zrangebyscore(A1,"salary","-inf","+inf") |
|
7 |
=redis_zrangebyscore(A1,"salary","-inf",10000,"WITHSCORES") |
|