Redis Lpush 命令

Redis 教程 · 2019-03-07 13:43:45

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

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

语法

redis Lpush 命令基本语法如下:

redis 127.0.0.1:6379> LPUSH KEY_NAME VALUE1.. VALUEN

可用版本

>= 1.0.0

返回值

执行 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 教程 文章: https://codercto.com/courses/l/33.html

查看所有标签

Real-Time Rendering, Third Edition

Real-Time Rendering, Third Edition

Tomas Akenine-Moller、Eric Haines、Naty Hoffman / A K Peters/CRC Press / 2008-7-25 / USD 102.95

Thoroughly revised, this third edition focuses on modern techniques used to generate synthetic three-dimensional images in a fraction of a second. With the advent or programmable shaders, a wide varie......一起来看看 《Real-Time Rendering, Third Edition》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具