diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-01-04 07:19:32 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-01-04 07:19:32 +0000 |
commit | 7480e618ec785ba8a1c74c8a150cffe5880fb3bb (patch) | |
tree | 87422376dd9a7eee55850f0fce9a8bb4c13e44a2 /iredis/data/commands/lmpop.md | |
parent | Adding upstream version 1.12.1. (diff) | |
download | iredis-upstream/1.13.0.tar.xz iredis-upstream/1.13.0.zip |
Adding upstream version 1.13.0.upstream/1.13.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'iredis/data/commands/lmpop.md')
-rw-r--r-- | iredis/data/commands/lmpop.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/iredis/data/commands/lmpop.md b/iredis/data/commands/lmpop.md new file mode 100644 index 0000000..aad5b6a --- /dev/null +++ b/iredis/data/commands/lmpop.md @@ -0,0 +1,35 @@ +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` or `RPOP` which take only one key, and can return multiple elements. +- `BLPOP` or `BRPOP` 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). + +@return + +@array-reply: specifically: + +* A `nil` when no element could be popped. +* A two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of elements. + +@examples + +```cli +LMPOP 2 non1 non2 LEFT COUNT 10 +LPUSH mylist "one" "two" "three" "four" "five" +LMPOP 1 mylist LEFT +LRANGE mylist 0 -1 +LMPOP 1 mylist RIGHT COUNT 10 +LPUSH mylist "one" "two" "three" "four" "five" +LPUSH mylist2 "a" "b" "c" "d" "e" +LMPOP 2 mylist mylist2 right count 3 +LRANGE mylist 0 -1 +LMPOP 2 mylist mylist2 right count 5 +LMPOP 2 mylist mylist2 right count 10 +EXISTS mylist mylist2 +``` |