RENAMENX

Syntax

1. RENAMENX key newkey

Time complexity: O(1)

Renames key to newkey if newkey does not yet exist. It returns an error when key does not exist.

Return

Integer reply, specifically:

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

Examples

1. dragonfly> SET mykey "Hello"
2. "OK"
3. dragonfly> SET myotherkey "World"
4. "OK"
5. dragonfly> RENAMENX mykey myotherkey
6. (integer) 0
7. dragonfly> GET myotherkey
8. "World"