YouTip LogoYouTip

Sorted Sets Zrank

# Redis Zrank Command * (javascript:void(0);) * (javascript:void(0);) * (javascript:void(0);) * (javascript:void(0)) Redis Tutorial (#)(#)(#)(#)(#) ## Redis Commands (#)(#)(#)(#)(#)(#)(#)(#)[Redis Pub/Sub](#)(#)(#)(#)(#)(#)(#) ## Redis Advanced Tutorial (#)(#)(#)(#)(#)(#)(#)(#) [](#)(#) (#)[](#) Deep Dive Computer Scripting Languages AI Tools, Chatbots, and Virtual Assistants Computer Hardware Web Applications and Online Tools Networking Data Management Scripts Programming Software # Redis Zrank Command !(#)(#) Redis Zrank returns the rank of a specified member in a sorted set. Members in the sorted set are ordered by their score values in ascending order (from smallest to largest). ### Syntax The basic syntax of the redis Zrank command is as follows: redis 127.0.0.1:6379> ZRANK key member ### Available Versions >= 2.0.0 ### Return Value If the member exists in the sorted set key, returns the rank of the member. If the member does not exist in the sorted set key, returns nil. ### Example redis 127.0.0.1:6379> ZRANGE salary 0 -1 WITHSCORES # Display all members and their score values1) "peter"2) "3500"3) "tom"4) "4000"5) "jack"6) "5000" redis 127.0.0.1:6379> ZRANK salary tom # Display tom's salary rank, second(integer) 1 !(#)(#)
← Sorted Sets ZremSorted Sets Zrangebyscore β†’