summaryrefslogtreecommitdiffstats
path: root/iredis/data/commands/rename.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2020-03-21 10:28:17 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-02-07 11:16:53 +0000
commit06cba6ccd165ca8b224797e37fccb9e63f026d77 (patch)
treee82f1bc439997ae296f2e74f8a64d84c5d95f140 /iredis/data/commands/rename.md
parentInitial commit. (diff)
downloadiredis-06cba6ccd165ca8b224797e37fccb9e63f026d77.tar.xz
iredis-06cba6ccd165ca8b224797e37fccb9e63f026d77.zip
Adding upstream version 1.9.1.upstream/1.9.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'iredis/data/commands/rename.md')
-rw-r--r--iredis/data/commands/rename.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/iredis/data/commands/rename.md b/iredis/data/commands/rename.md
new file mode 100644
index 0000000..5a38f63
--- /dev/null
+++ b/iredis/data/commands/rename.md
@@ -0,0 +1,26 @@
+Renames `key` to `newkey`. It returns an error when `key` does not exist. If
+`newkey` already exists it is overwritten, when this happens `RENAME` executes
+an implicit `DEL` operation, so if the deleted key contains a very big value it
+may cause high latency even if `RENAME` itself is usually a constant-time
+operation.
+
+In Cluster mode, both `key` and `newkey` must be in the same **hash slot**,
+meaning that in practice only keys that have the same hash tag can be reliably
+renamed in cluster.
+
+@history
+
+- `<= 3.2.0`: Before Redis 3.2.0, an error is returned if source and destination
+ names are the same.
+
+@return
+
+@simple-string-reply
+
+@examples
+
+```cli
+SET mykey "Hello"
+RENAME mykey myotherkey
+GET myotherkey
+```