Redis Append 命令

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

Redis Append 命令用于为指定的 key 追加值。

如果 key 已经存在并且是一个字符串, APPEND 命令将 value 追加到 key 原来的值的末尾。

如果 key 不存在, APPEND 就简单地将给定 key 设为 value ,就像执行 SET key value 一样。

语法

redis 127.0.0.1:6379> APPEND KEY_NAME NEW_VALUE

返回值

追加指定值之后, key 中字符串的长度。

实例

实例1:key 存在

127.0.0.1:6379> set domain codercto.com
OK
127.0.0.1:6379> append domain new
15
127.0.0.1:6379> get domain
codercto.comnew

实例2:key 不存在

127.0.0.1:6379> del domain
0
127.0.0.1:6379> append domain codercto
8
127.0.0.1:6379> get domain
codercto

查看更多 Redis 字符串(String)命令

Software Engineering for Internet Applications

Software Engineering for Internet Applications

Eve Andersson、Philip Greenspun、Andrew Grumet / The MIT Press / 2006-03-06 / USD 35.00

After completing this self-contained course on server-based Internet applications software, students who start with only the knowledge of how to write and debug a computer program will have learned ho......一起来看看 《Software Engineering for Internet Applications》 这本书的介绍吧!

XML 在线格式化

XML 在线格式化

在线 XML 格式化压缩工具

UNIX 时间戳转换

UNIX 时间戳转换

UNIX 时间戳转换

HSV CMYK 转换工具

HSV CMYK 转换工具

HSV CMYK互换工具