ZPOPMAX
Syntax
Section titled “Syntax”ZPOPMAX key [count]
ZPOPMAX removes and returns the member with the highest score from the sorted set at the specified key.
If the key does not exist, the command returns empty list. An optional “count” argument can be provided to remove and return multiple members (up to the number specified).
When popped, the elements are returned in descending order of score and you get the rank of the element in the sorted set. The rank is 1-based, which means that the first element is at rank 1 and not rank 0. The 1), 2), 3), … is the rank of the element in the sorted set.
Examples
Section titled “Examples”localhost:7379> ZADD users 10 alice 20 bob 30 charlieOK 3localhost:7379> ZPOPMAX usersOK3) 30, charlielocalhost:7379> ZPOPMAX users 10OK2) 20, bob1) 10, alice