rename
RENAME
Rename a key
Usage: rename key new_key [type].
You can rename keys of all data types, not only strings.
If new_key already exists, it is deleted (DEL). If you do not want that, use RENAMENX.
type is one of string/list/set/zset/hash/stream.
The type argument was added in ent811. Please use it.
Example
| Command> | mset key1 value1 key2 value2 |
| Result> | OK |
| Command> | rename key1 key2 string |
| Result> | OK |
| Command> | get key2 |
| Result> | value1 |
Syntax
RENAME key new_key [type]
- Available since version 1.0.0.
- Time complexity is O(1).
- The type argument was added in ent811.