Redis参考手册
列表 | Lists
lset
LSET key index value
自1.0.0起可用。
时间复杂度: O(N)其中N是列表的长度。设置列表的第一个或最后一个元素是O(1)。
将列表元素设置index
为value
。有关index
参数的更多信息,请参阅LINDEX。
超出范围索引会返回错误。
返回值
简单字符串回复
例子
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"
列表 | Lists相关

Redis 是一个开源的使用 ANSI C 语言编写、遵守 BSD 协议、支持网络、可基于内存亦可持久化的日志型、Key-Value 数据库,并提供多种语言的 API。 它通常被称为数据结构服务器,因为值( value )可以是 字符串( String ), 哈希(Map),列表(list),集合( sets ) 和 有序集合( sorted sets )等类型。
主页 | https://redis.io/ |
源码 | https://github.com/antirez/redis |
发布版本 | 4.0.2 |