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
Code Complete
Steve McConnell / Microsoft Press / 2004-6-19 / GBP 40.99
在线阅读本书 Widely considered one of the best practical guides to programming, Steve McConnells original CODE COMPLETE has been helping developers write better software for more than a decade. Now......一起来看看 《Code Complete》 这本书的介绍吧!