BLMPOP
BLMPOP timeout numkeys key [key ...] <LEFT | RIGHT> [COUNT count]
- Available since:
- Redis Open Source 7.0.0
- Time complexity:
- O(N+M) where N is the number of provided keys and M is the number of elements returned.
- ACL categories:
-
@write,@list,@slow,@blocking, - Compatibility:
- Redis Software and Redis Cloud compatibility
BLMPOP is the blocking variant of LMPOP.
When any of the lists contains elements, this command behaves exactly like LMPOP.
When used inside a MULTI/EXEC block or a Lua script, this command behaves exactly like LMPOP.
When all lists are empty, Redis will block the connection until another client pushes to it or until the timeout (a double value specifying the maximum number of seconds to block) elapses.
A timeout of zero can be used to block indefinitely.
See LMPOP for more information.
Required arguments
timeout
The maximum time to block, in seconds. A timeout of 0 blocks indefinitely.
numkeys
The number of keys that follow.
key [key ...]
One or more keys of lists to operate on.
LEFT | RIGHT
The end of the list to pop elements from: LEFT (head) or RIGHT (tail).
Optional arguments
COUNT count
The number of elements to pop. Defaults to 1.
Redis Software and Redis Cloud compatibility
| Redis Software |
Redis Cloud |
Notes |
|---|---|---|
| ✅ Standard |
✅ Standard |
Return information
One of the following:
- Nil reply: when no element could be popped and the timeout is reached.
- Array reply: a two-element array with the first element being the name of the key from which elements were popped, and the second element being an array of the popped elements.