RENAME(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’– RENAME β€” the valkey manual page, but make it cute πŸ’–

okay bestie, welcome to the RENAME(3valkey) page, part of the Valkey Command Manual. this one's short, sweet, and honestly iconic. let's get into it 🫢


✨ NAME ✨

rename β€” renames a key and overwrites the destination. that's it. that's the whole job. no cap. πŸ’…


✨ SYNOPSIS ✨

RENAME key newkey

✨ DESCRIPTION ✨

so the vibe is: it renames key to newkey. and if key doesn't exist?? it returns an error. sorry babe. 😭

if newkey already exists, it gets overwritten. by default, Valkey uses implicit lazy freeing (basically the same energy as UNLINK), so large values get released asynchronously β€” like, it's not gonna block you, she's multitasking. 🧚

but listen. if lazy freeing is disabled and synchronous deletion is configured, then overwriting a key with a very large value may cause high latency. so like… know your config, bestie. πŸ’€

and in Cluster mode?? both key and newkey have to be in the same hash slot. which means, in practice, only keys with the same hash tag can be reliably renamed in cluster. lowkey restrictive but that's just how she works. πŸ’œ


✨ REPLY ✨

valkey-protocol(7) Simple string reply: OK.


✨ COMPLEXITY ✨

O(1). instant. effortless. main character energy. πŸ‘‘


✨ ACL CATEGORIES ✨

@keyspace @slow @write


✨ HISTORY ✨

  • available since: 1.0.0 β€” an OG, fr fr 🌸

✨ EXAMPLES ✨

127.0.0.1:6379> SET mykey "Hello"
OK
127.0.0.1:6379> RENAME mykey myotherkey
OK
127.0.0.1:6379> GET myotherkey
"Hello"

see how that worked?? set it, rename it, get it back under the new name. ate. πŸ“


✨ SEE ALSO ✨

copy(3valkey), del(3valkey), dump(3valkey), exists(3valkey), expire(3valkey), expireat(3valkey), expiretime(3valkey), keys(3valkey), migrate(3valkey), move(3valkey), object(3valkey), object-encoding(3valkey), object-freq(3valkey), object-help(3valkey), object-idletime(3valkey), object-refcount(3valkey), persist(3valkey), pexpire(3valkey), pexpireat(3valkey), pexpiretime(3valkey), pttl(3valkey), randomkey(3valkey), renamenx(3valkey), restore(3valkey), scan(3valkey), sort(3valkey), sort_ro(3valkey), touch(3valkey), ttl(3valkey), type(3valkey), unlink(3valkey), wait(3valkey), waitaof(3valkey)


okay that's the whole page, you're officially educated πŸ’– this was Valkey version 9.0.0, dated 2025-10-21, and it's giving manual page, it's giving reference material, it's giving ✨. go rename something. slay. πŸŽ€πŸ¦‹β­

πŸ“¦ where this page comes from