BLMPOP(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’– 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