List

LPUSH

Push an element at the head of the list.

Arguments

keybodystringrequired

The key of the list.

elementsbody...TValue[]required

One or more elements to push at the head of the list.

Response

numberrequired

The length of the list after the push operation.

Example
const length1 = await redis.lpush("key", "a", "b", "c"); console.log(length1); // 3const length2 = await redis.lpush("key", "d"); console.log(length2); // 4
Loading search…