BLMPOP(3valkey)
π BLMPOP β bestie edition π
valkey command manual Β· section 3valkey Β· the blocking list-popper that waits for you like a loyal bestie π«Ά
β¨ NAME β¨
blmpop β pops the first element from one of multiple lists. Blocks until an element is available otherwise. Deletes the list if the last element was popped. π
πΈ SYNOPSIS πΈ
BLMPOP timeout numkeys key [key...] <LEFT | RIGHT> [COUNT count]
π¦ DESCRIPTION π¦
Okay so BLMPOP is literally the blocking version of valkey-lmpop(7) LMPOP. Same energy, but it waits. π
When any of the lists contains elements, this command behaves exactly like LMPOP. No cap.
When you use it inside a valkey-multi(7) MULTI / valkey-exec(7) EXEC block, it also behaves exactly like LMPOP β no blocking in there, it just does the thing. β¨
But when all the lists are empty, Valkey will block the connection until another client pushes to it, or until the timeout elapses. That timeout is a double value specifying the max number of seconds to block. And bestie, a timeout of zero means block indefinitely π (iconic, honestly).
See valkey-lmpop(7) LMPOP for more information.
π REPLY π
RESP2
One of the following:
valkey-protocol(7)Nil reply: when no element could be popped and the timeout is reached.valkey-protocol(7)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.
RESP3
One of the following:
valkey-protocol(7)Null reply: when no element could be popped and the timeout is reached.valkey-protocol(7)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.
ngl the only glow-up between RESP2 and RESP3 here is Nil β Null. that's it. that's the vibe check. π
π COMPLEXITY π
O(N+M) where N is the number of provided keys and M is the number of elements returned.
π₯ ACL CATEGORIES π₯
@blocking @list @slow @write
β HISTORY β
- Available since:
7.0.0
π SEE ALSO π
blmove(3valkey), blpop(3valkey), brpop(3valkey), brpoplpush(3valkey), lindex(3valkey), linsert(3valkey), llen(3valkey), lmove(3valkey), lmpop(3valkey), lpop(3valkey), lpos(3valkey), lpush(3valkey), lpushx(3valkey), lrange(3valkey), lrem(3valkey), lset(3valkey), ltrim(3valkey), rpop(3valkey), rpoplpush(3valkey), rpush(3valkey), rpushx(3valkey)
version 9.0.0 Β· dated 2025-10-21 Β· page BLMPOP(3valkey) β ok that's the whole manual bestie, go pop some lists, you ate π
β¨ππ¦πΈπ«Ά
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms