Redis Renamenx 命令

Redis 教程 · 2019-03-06 21:11:28

Redis Renamenx 命令用于在新的 key 不存在时修改 key 的名称 。

语法

redis Renamenx 命令基本语法如下:

redis 127.0.0.1:6379> RENAMENX OLD_KEY_NAME NEW_KEY_NAME

可用版本

>= 1.0.0

返回值

修改成功时,返回 1 。 如果 NEW_KEY_NAME 已经存在,返回 0 。

实例

# newkey 不存在,改名成功

redis> SET player "MPlyaer"
OK

redis> EXISTS best_player
(integer) 0

redis> RENAMENX player best_player
(integer) 1


# newkey存在时,失败

redis> SET animal "bear"
OK

redis> SET favorite_animal "butterfly"
OK

redis> RENAMENX animal favorite_animal
(integer) 0

redis> get animal
"bear"

redis> get favorite_animal
"butterfly"

点击查看所有 Redis 教程 文章: https://codercto.com/courses/l/33.html

查看所有标签

Developing Large Web Applications

Developing Large Web Applications

Kyle Loudon / Yahoo Press / 2010-3-15 / USD 34.99

As web applications grow, so do the challenges. These applications need to live up to demanding performance requirements, and be reliable around the clock every day of the year. And they need to withs......一起来看看 《Developing Large Web Applications》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

html转js在线工具
html转js在线工具

html转js在线工具

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

HEX HSV 互换工具