What's new in Valkey 9.0? Discover new features and improvements. Read the announcement.

MOVE

Moves a key to another database.

Usage
MOVE key db
Complexity
O(1)
Since
1.0.0
ACL Categories
@fast, @keyspace, @write
Command flags
WRITE, FAST

Move key from the currently selected database (see SELECT) to the specified destination database. When key already exists in the destination database, or it does not exist in the source database, it does nothing. It is possible to use MOVE as a locking primitive because of this.

Replies

RESP2

One of the following:

  • Integer reply: 1 if key was moved.
  • Integer reply: 0 if key already exists in the destination database, or it does not exist in the source database.

RESP3

One of the following:

  • Integer reply: 1 if key was moved.
  • Integer reply: 0 if key already exists in the destination database, or it does not exist in the source database.