MOVE(3valkey)

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

πŸ’… 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: 1 if key was moved. βœ… slay, it relocated.
  • valkey-protocol(7) Integer reply: 0 if key already exists in the destination database, or it does not exist in the source database. πŸ’€ nothing happened, no notes.

πŸ”₯ COMPLEXITY πŸ”₯

O(1)

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:


⚠️ quick reminder bestie: if the key's already chillin' in the destination db, or if it never existed in the source db, MOVE returns 0 and 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