Syntax
Prevoius
Next
Home
LREM key count value
Removes first count
occurrences of value from the list.
Returns
Number of removed elements.
Condition | description |
count > 0 | Remove elements equal to value moving from head to tail. |
count < 0 | Remove elements equal to value moving from tail to head. |
count = 0 | Remove all elements equal to value |
127.0.0.1:6379> lpush list1 1 2 3 4 3 2 3 5 3 6 3 8 (integer) 12 127.0.0.1:6379> lpush list2 1 2 3 4 3 2 3 5 3 6 3 8 (integer) 12 127.0.0.1:6379> lpush list3 1 2 3 4 3 2 3 5 3 6 3 8 (integer) 12 127.0.0.1:6379> lrem list1 2 3 (integer) 2 127.0.0.1:6379> lrem list2 -2 3 (integer) 2 127.0.0.1:6379> lrem list3 0 3 (integer) 5 127.0.0.1:6379> lrange list1 0 12 1) "8" 2) "6" 3) "5" 4) "3" 5) "2" 6) "3" 7) "4" 8) "3" 9) "2" 10) "1" 127.0.0.1:6379> lrange list2 0 12 1) "8" 2) "3" 3) "6" 4) "3" 5) "5" 6) "3" 7) "2" 8) "4" 9) "2" 10) "1" 127.0.0.1:6379> lrange list3 0 12 1) "8" 2) "6" 3) "5" 4) "2" 5) "4" 6) "2" 7) "1" 127.0.0.1:6379>
No comments:
Post a Comment