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)命令

High Performance Python

High Performance Python

Micha Gorelick、Ian Ozsvald / O'Reilly Media / 2014-9-10 / USD 39.99

If you're an experienced Python programmer, High Performance Python will guide you through the various routes of code optimization. You'll learn how to use smarter algorithms and leverage peripheral t......一起来看看 《High Performance Python》 这本书的介绍吧!

Base64 编码/解码

Base64 编码/解码

Base64 编码/解码

RGB CMYK 转换工具

RGB CMYK 转换工具

RGB CMYK 互转工具

HEX HSV 转换工具

HEX HSV 转换工具

HEX HSV 互换工具