I’ve been experimenting with the command ZREVRANK in redis and it seems to work great on single items but I can’t seem to find a way of returning the ranks of all items in a set:
“item1” score:3
“item2” score:5
“item3” score:2
“item4” score:3
“item5” score:7
ranked results:
“item5” score:7 rank:0
“item2” score:5 rank:1
“item1” score:3 rank:2
“item4” score:3 rank:2
“item3” score:2 rank:3
I wonder if anyone has found a way of achieving this?
Have you looked at not using zrange or zrevrange?
zcard will give you the total number of elements in the set.