List

LREM

Remove the first `count` occurrences of an element from a list.

Arguments

keybodystrrequired

The key of the list.

countbodynumberrequired

How many occurrences of the element to remove.

elementbodyAnyrequired

The element to remove

Response

intrequired

The number of elements removed.

Example
redis.rpush("mylist", "one", "two", "three", "two", "one")assert redis.lrem("mylist", 2, "two") == 2assert redis.lrange("mylist", 0, -1) == ["one", "three", "one"]
Loading search…