ZRANK
Syntax
Section titled “Syntax”ZRANK key member
ZRANK returns the rank of a member in a sorted set, ordered from low to high scores.
The rank is 1-based which means that the member with the lowest score has rank 1, the next highest has rank 2, and so on. The command returns the element - rank, score, and memeber.
Thus, 1), 2), 3) are the rank of the element in the sorted set, followed by the score and the member.
The the member passed as the second argument is not a member of the sorted set, the command returns a valid response with a rank of 0 and score of 0. If the key does not exist, the command returns a valid response with a rank of 0, score of 0, and the member as "".
Examples
Section titled “Examples”localhost:7379> ZADD users 10 alice 20 bob 30 charlieOK 3localhost:7379> ZRANK users bobOK 2) 20, boblocalhost:7379> ZRANK users charlieOK 3) 30, charlielocalhost:7379> ZRANK users danielOK 0) 0, daniel