Sunday, 12 April 2015

ZREVRANGE key start stop [WITHSCORES]

Syntax
ZREVRANGE key start stop [WITHSCORES]
     Returns elements from sorted set from start to stop. Returned elements ordered from the highest to the lowest score. 

127.0.0.1:6379> zadd set1 1 one 2 two 3 three 4 four 5 five 
(integer) 5 
127.0.0.1:6379> zadd set1 1 six 2 seven 3 eight 4 nine 5 ten 
(integer) 5 
127.0.0.1:6379> zadd set1 1 eleven 2 twelve 3 thirteen 4 fourteen 5 fifteen 
(integer) 5 
127.0.0.1:6379> zrevrange set1 2 5 
1) "fifteen" 
2) "nine" 
3) "fourteen" 
4) "four" 
127.0.0.1:6379> zrevrange set1 2 5 withscores 
1) "fifteen" 
2) "5" 
3) "nine" 
4) "4" 
5) "fourteen" 
6) "4" 
7) "four" 
8) "4" 
127.0.0.1:6379> zrevrange set1 0 5 withscores 
 1) "ten" 
 2) "5" 
 3) "five" 
 4) "5" 
 5) "fifteen" 
 6) "5" 
 7) "nine" 
 8) "4" 
 9) "fourteen" 
10) "4" 
11) "four" 
12) "4" 
127.0.0.1:6379> 

 
Prevoius                                                 Next                                                 Home

No comments:

Post a Comment