redis_zrank()

Read(256) Label: sorted set, key, member ranking,

Description:

Determine the ranking of a member in a sorted set.

Syntax:

redis_zrank(con,key,member) 

Note:

External library function. By default the members in a sorted set is arranged in an ascending order; use @z option to arrange them in a descending order. 

The rankings start with 0, meaning the ranking of the member with the smallest score is 0.

If the given member doesn’t belong to the sorted set, return an empty table.

Options:

@z  Arrange sorted set members in descending order.

Parameters:

con

Database connection string

key

Sorted set name

member

Sorted set member

Return value:

Table sequence

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_zrangebyscore(A1,"salary","-inf","+inf","WITHSCORES")

3

=redis_zrank(A1,"salary","jack")

4

=redis_zrank@z(A1,"salary","jack")