Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

BLMOVE

Last updated
BLMOVE source destination LEFT | RIGHT LEFT | RIGHT timeout
Group
List
Complexity
O(1)
Arity
6 (exactly, counting the command name)
Flags
write, blocking
Keys
first 1, last 2, step 1
HotKV Cloud
All plans
On-Premise
no license needed

BLMOVE is the blocking form of LMOVE. If the list at source has an element, it is moved to destination at once, exactly as LMOVE would. If source is empty or missing, the connection waits until another client pushes to source, or until timeout passes.

timeout is in seconds and can have a fractional part. 0 waits forever. Inside MULTI / EXEC and inside scripts, BLMOVE never waits and replies at once as if the timeout had expired.

If, when an element becomes available, destination holds a value that is not a list, the wait ends with a WRONGTYPE error and nothing is moved.

Option Effect
LEFT / RIGHT (first) The end of source to pop from.
LEFT / RIGHT (second) The end of destination to push to.
timeout Seconds to wait; 0 waits forever.
Case RESP2 RESP3
Moved Bulk string: the element that was moved Same
Timeout expired Nil bulk string Null

Errors:

  • ERR syntax error if a direction is not LEFT or RIGHT.
  • ERR timeout is not a float or out of range, ERR timeout is negative, or ERR timeout is out of range for a bad timeout.
  • WRONGTYPE if source is not a list, or destination exists and is not a list when an element is moved.
127.0.0.1:6379> RPUSH jobs:pending j1
(integer) 1
127.0.0.1:6379> BLMOVE jobs:pending jobs:active LEFT RIGHT 10
"j1"
127.0.0.1:6379> BLMOVE jobs:pending jobs:active LEFT RIGHT 0.5
(nil)
(0.50s)

Same as Redis 7.4 and Valkey 8.

LMOVE, BRPOPLPUSH, BLPOP, BLMPOP