blmpop.3valkey - Man Page

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

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, this command behaves exactly like LMPOP. When all lists are empty, Valkey 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.

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.

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

See Also

blmove(3valkey), blpop(3valkey), brpop(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), rpush(3valkey), rpushx(3valkey)

Info

2024-09-23 8.0.0 Valkey Command Manual