List

LINSERT

Insert an element before or after another element in a list

Arguments

keybodystrrequired

The key of the list.

directionbody"BEFORE" | "AFTER"required

Whether to insert the element before or after pivot.

pivotbodyAnyrequired

The element to insert before or after.

valuebodyAnyrequired

The element to insert.

Response

intrequired

The list length after insertion, 0 when the list doesn't exist or -1 when pivot was not found.

Example
redis.rpush("key", "a", "b", "c")redis.linsert("key", "before", "b", "x")
Loading search…