Insert an element before or after another element in a list
method
RedisClient.linsert
position: 'BEFORE' | 'AFTER',
): Promise<number>;
@param key
The list key
@param position
"BEFORE" or "AFTER" to specify where to insert
@param pivot
The pivot element to insert before or after
@param element
The element to insert
@returns
Promise that resolves with the length of the list after insert, -1 if pivot not found, or 0 if key doesn't exist
await redis.lpush("mylist", "World");
await redis.lpush("mylist", "Hello");
await redis.linsert("mylist", "BEFORE", "World", "There");
// List is now: ["Hello", "There", "World"]
Referenced types
type KeyLike = string | ArrayBufferView | Blob