LSET

Syntax
LSET key index element
Available since:
1.0.0
Time complexity:
O(N) where N is the length of the list. Setting either the first or the last element of the list is O(1).
ACL categories:
@write, @list, @slow,

将列表中的元素设置为index处的element。 有关index参数的更多信息,请参见LINDEX

对于超出范围的索引,将返回错误。

示例

RPUSH mylist "one" RPUSH mylist "two" RPUSH mylist "three" LSET mylist 0 "four" LSET mylist -2 "five" LRANGE mylist 0 -1

RESP2/RESP3 回复

Simple string reply: OK.
RATE THIS PAGE
Back to top ↑