修改本页

Redis 命令 客户端 文档 社区 下载 问题 支持 许可

RENAMENX key newkey

相关命令

始于1.0.0可用。

时间复杂度: O(1)

Renames key to newkey if newkey does not yet exist. It returns an error under the same conditions as RENAME.

返回值

Integer reply, specifically:

  • 1 if key was renamed to newkey.
  • 0 if newkey already exists.

例子

redis> SET mykey "Hello"

  1. OK

redis> SET myotherkey "World"

  1. OK

redis> RENAMENX mykey myotherkey

  1. (integer) 0

redis> GET myotherkey

  1. "World"
redis>

Comments powered by Disqus

This website is open source software developed by Citrusbyte.

The Redis logo was designed by Carlos Prioglio. See more credits.

Sponsored by Redis Support