LINSERT key BEFORE|AFTER pivot value
value in the list stored at
key either before or after the reference value
key does not exist, it is considered an empty list and no operation is performed.
An error is returned when
key exists but does not hold a list value.
Integer reply: the length of the list after the insert operation, or
-1 when the value
pivot was not found.
(integer) 1redis> RPUSH mylist "World"
(integer) 2redis> LINSERT mylist BEFORE "World" "There"
(integer) 3redis> LRANGE mylist 0 -1
1) "Hello" 2) "There" 3) "World"
© 2009–2018 Salvatore Sanfilippo
Licensed under the Creative Commons Attribution-ShareAlike License 4.0.