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

Game Engine Architecture, Second Edition

Game Engine Architecture, Second Edition

Jason Gregory / A K Peters/CRC Press / 2014-8-15 / USD 69.95

A 2010 CHOICE outstanding academic title, this updated book covers the theory and practice of game engine software development. It explains practical concepts and techniques used by real game studios,......一起来看看 《Game Engine Architecture, Second Edition》 这本书的介绍吧!

HTML 编码/解码

HTML 编码/解码

HTML 编码/解码

MD5 加密

MD5 加密

MD5 加密工具

RGB HSV 转换

RGB HSV 转换

RGB HSV 互转工具