Redis

RENAMENX key newkey

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

Return value

Integer reply, specifically:

Examples

redis>  SET mykey "Hello"
OK
redis>  SET myotherkey "World"
OK
redis>  RENAMENX mykey myotherkey
(integer) 0
redis>  GET myotherkey
"World"
redis> 
Comments powered by Disqus