Sunday 12 April 2015

LSET key index value

Syntax
LSET key index value
     Sets the list index with given value.

127.0.0.1:6379> lpush ids 1 2 3 4 5 
(integer) 5 
127.0.0.1:6379> lrange ids 0 4 
1) "5" 
2) "4" 
3) "3" 
4) "2" 
5) "1" 
127.0.0.1:6379> lset ids 2 100 
OK 
127.0.0.1:6379> lset ids 4 200 
OK 
127.0.0.1:6379> lrange ids 0 4 
1) "5" 
2) "4" 
3) "100" 
4) "2" 
5) "200" 


index out of range” error thrown, if index is out of range.


127.0.0.1:6379> lset ids 6 200 
(error) ERR index out of range 


   
Prevoius                                                 Next                                                 Home

No comments:

Post a Comment