Sunday, 12 April 2015

LRANGE key start stop

Syntax
LRANGE key start stop
     Returns elements of list for specified range.

127.0.0.1:6379> lrange ids 0 9 
1) "1" 
2) "2" 
3) "3" 
4) "4" 
5) "5" 
6) "6" 
7) "7" 
8) "8" 
9) "9" 
127.0.0.1:6379> lrange ids 3 6 
1) "4" 
2) "5" 
3) "6" 
4) "7" 
 
You can specify range in -ve numbers also, -1 represents end of the list.

127.0.0.1:6379> lrange ids -5 -1 
1) "5" 
2) "6" 
3) "7" 
4) "8" 
5) "9" 
127.0.0.1:6379> lrange ids 0 -1 
1) "1" 
2) "2" 
3) "3" 
4) "4" 
5) "5" 
6) "6" 
7) "7" 
8) "8" 
9) "9" 

Prevoius                                                 Next                                                 Home

No comments:

Post a Comment