MOVE(3valkey)
π MOVE β the glow-up your key deserves
okay so bestie, welcome to the Valkey Command Manual entry for move, and yes it's from the 3valkey manual section, we're being β¨officialβ¨ today. This is the command that picks your key up from one database and drops it off in another like it's moving apartments but the movers are instant and free. π β‘οΈπ
β¨ NAME β¨
move β Moves a key to another database. that's it. that's the whole job. simple queen behavior. π
πΈ SYNOPSIS πΈ
MOVE key db
Two little arguments and a whole lot of relocation energy. π«
π DESCRIPTION π
So here's the tea, bestie: MOVE takes key from the database you currently have selected (that's the whole SELECT situation, see valkey-select(7)) and yeets it over to the destination database you named in db. π
And here's the part that lowkey makes it iconic β if key already exists in the destination database, or if it doesn't exist in the source database at all, this command justβ¦ does nothing. No error. No drama. Just vibes and silence. π
Which means β and this is the fun bit β you can literally use MOVE as a locking primitive because of this behavior. fr fr. it's giving "mutex but make it a key move." πβ¨
π REPLY π
You get one of the following, queen:
valkey-protocol(7)Integer reply:1if key was moved. β slay, it relocated.valkey-protocol(7)Integer reply:0if key already exists in the destination database, or it does not exist in the source database. π nothing happened, no notes.
π₯ COMPLEXITY π₯
constant time, bestie. it does not care how big your keyspace is. it does not care about your feelings either. it's just fast. β‘
π¦ ACL CATEGORIES π¦
@fast @keyspace @write
yes she's fast, yes she touches keyspace, yes she writes. a triple threat. π
π HISTORY π
- Available since:
1.0.0β an OG, no cap. been here since the very beginning and never left. π
π SEE ALSO π
go read these next, bestie, they're all part of the same friend group:
copy(3valkey)del(3valkey)dump(3valkey)exists(3valkey)expire(3valkey)expireat(3valkey)expiretime(3valkey)keys(3valkey)migrate(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)rename(3valkey)renamenx(3valkey)restore(3valkey)scan(3valkey)sort(3valkey)sort_ro(3valkey)touch(3valkey)ttl(3valkey)type(3valkey)unlink(3valkey)wait(3valkey)waitaof(3valkey)
β οΈ quick reminder bestie: if the key's already chillin' in the destination db, or if it never existed in the source db,MOVEreturns0and does absolutely nothing. that's not a bug, that's the whole locking-primitive thing working as designed. don't come for her. π«Ά
okay that's the whole page, mwah π β this was version 9.0.0, dated 2025-10-21, straight from the MOVE(3valkey) manual. go forth and relocate your keys, you absolute icon. π
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms