RENAMENX

Since 1.1.0Keys

Syntax

RENAMENX source destination
  • Flags: write
  • ACL categories: @generic, @keyspace, @slow, @write
  • Arity: 3

Renames source to destination only if destination does not exist.

Reply

  • 1 if the key was renamed.
  • 0 if destination exists; nothing changes.
  • ERR no such key if source does not exist.

Examples

> SET r2 v
OK
> SET r3 v
OK
> RENAMENX r2 r3
(integer) 0
> RENAMENX r2 r4
(integer) 1