LSET key index value

Sets the list element at index to value. For more information on the index argument, see LINDEX.

An error is returned for out of range indexes.

*Return value

Simple string reply


redis>  RPUSH mylist "one"
(integer) 1
redis>  RPUSH mylist "two"
(integer) 2
redis>  RPUSH mylist "three"
(integer) 3
redis>  LSET mylist 0 "four"
redis>  LSET mylist -2 "five"
redis>  LRANGE mylist 0 -1
1) "four"
2) "five"
3) "three"
Comments powered by Disqus