LSET key index value
相关命令
- BLPOP
- BRPOP
- BRPOPLPUSH
- LINDEX
- LINSERT
- LLEN
- LPOP
- LPUSH
- LPUSHX
- LRANGE
- LREM
- LSET
- LTRIM
- RPOP
- RPOPLPUSH
- RPUSH
- RPUSHX
始于1.0.0可用。
时间复杂度: O(N) where N is the length of the list. Setting either the first or the last element of the list is O(1).
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.
返回值
例子
redis> RPUSH mylist "one"
- (integer) 1
redis> RPUSH mylist "two"
- (integer) 2
redis> RPUSH mylist "three"
- (integer) 3
redis> LSET mylist 0 "four"
- OK
redis> LSET mylist -2 "five"
- OK
redis> LRANGE mylist 0 -1
- 1) "four"
- 2) "five"
- 3) "three"
This website is open source software developed by Citrusbyte.
The Redis logo was designed by Carlos Prioglio. See more credits.