From 06cba6ccd165ca8b224797e37fccb9e63f026d77 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 21 Mar 2020 11:28:17 +0100 Subject: Adding upstream version 1.9.1. Signed-off-by: Daniel Baumann --- iredis/data/commands/lrem.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 iredis/data/commands/lrem.md (limited to 'iredis/data/commands/lrem.md') diff --git a/iredis/data/commands/lrem.md b/iredis/data/commands/lrem.md new file mode 100644 index 0000000..c06dda7 --- /dev/null +++ b/iredis/data/commands/lrem.md @@ -0,0 +1,28 @@ +Removes the first `count` occurrences of elements equal to `element` from the +list stored at `key`. The `count` argument influences the operation in the +following ways: + +- `count > 0`: Remove elements equal to `element` moving from head to tail. +- `count < 0`: Remove elements equal to `element` moving from tail to head. +- `count = 0`: Remove all elements equal to `element`. + +For example, `LREM list -2 "hello"` will remove the last two occurrences of +`"hello"` in the list stored at `list`. + +Note that non-existing keys are treated like empty lists, so when `key` does not +exist, the command will always return `0`. + +@return + +@integer-reply: the number of removed elements. + +@examples + +```cli +RPUSH mylist "hello" +RPUSH mylist "hello" +RPUSH mylist "foo" +RPUSH mylist "hello" +LREM mylist -2 "hello" +LRANGE mylist 0 -1 +``` -- cgit v1.2.3