BLMOVE
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.
Options
Section titled “Options”| 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. |
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Moved | Bulk string: the element that was moved | Same |
| Timeout expired | Nil bulk string | Null |
Errors:
ERR syntax errorif a direction is notLEFTorRIGHT.ERR timeout is not a float or out of range,ERR timeout is negative, orERR timeout is out of rangefor a badtimeout.WRONGTYPEifsourceis not a list, ordestinationexists and is not a list when an element is moved.
Examples
Section titled “Examples”127.0.0.1:6379> RPUSH jobs:pending j1(integer) 1127.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)Compatibility
Section titled “Compatibility”Same as Redis 7.4 and Valkey 8.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.