LMPOP
Syntax
LMPOP numkeys key [key ...] <LEFT | RIGHT> [COUNT count]
- Available since:
- 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
,
Pops one or more elements from the first non-empty list key from the list of provided key names.
LMPOP
and BLMPOP
are similar to the following, more limited, commands:
LPOP
orRPOP
which take only one key, and can return multiple elements.BLPOP
orBRPOP
which take multiple keys, but return only one element from just one key.
See BLMPOP
for the blocking variant of this command.
Elements are popped from either the left or right of the first non-empty list based on the passed argument. The number of returned elements is limited to the lower between the non-empty list's length, and the count argument (which defaults to 1).
Examples
RESP2 Reply
One of the following:
- Nil reply: if no element could be popped.
- 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 elements.
RESP3 Reply
One of the following:
- Null reply: if no element could be popped.
- 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 elements.