Renames key
to newkey
if newkey
does not yet exist.
It returns an error under the same conditions as RENAME.
返回值
Integer reply, specifically:
1
ifkey
was renamed tonewkey
.0
ifnewkey
already exists.
例子
redis>
SET mykey "Hello"
OKredis> SET myotherkey "World"
OKredis> RENAMENX mykey myotherkey
(integer) 0redis> GET myotherkey
"World"