Redis Lpush 命令

更新时间: 2019-07-07 15:54

Redis Lpush 命令将一个或多个值插入到列表头部。 如果 key 不存在,一个空列表会被创建并执行 LPUSH 操作。 当 key 存在但不是列表类型时,返回一个错误。

注意:在Redis 2.4版本以前的 LPUSH 命令,都只接受单个 value 值。

语法

redis 127.0.0.1:6379> LPUSH KEY_NAME VALUE1.. VALUEN

返回值

执行 LPUSH 命令后,列表的长度。

实例

127.0.0.1:6379> LPUSH list1 "foo"
(integer) 1
127.0.0.1:6379> LPUSH list1 "bar"
(integer) 2
127.0.0.1:6379> LRANGE list1 0 -1
1) "bar"
2) "foo"

查看更多 Redis 列表(List)命令

The Information

The Information

James Gleick / Vintage / 2012-3-6 / USD 16.95

James Gleick, the author of the best sellers Chaos and Genius, now brings us a work just as astonishing and masterly: a revelatory chronicle and meditation that shows how information has become th......一起来看看 《The Information》 这本书的介绍吧!

HTML 压缩/解压工具

HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JS 压缩/解压工具

JS 压缩/解压工具

在线压缩/解压 JS 代码

RGB转16进制工具

RGB转16进制工具

RGB HEX 互转工具