List

LINSERT

Insert an element before or after another element in a list

Arguments

keybodystringrequired

The key of the list.

directionbodybefore | afterrequired

Whether to insert the element before or after pivot.

pivotbodyTValuerequired

The element to insert before or after.

valuebodyTValuerequired

The element to insert.

Response

integerrequired

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

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