tencent cloud

Client.lPush
Last updated: 2025-03-11 20:05:00
Client.lPush
Last updated: 2025-03-11 20:05:00
The lPush method is used to insert one or more values at the head of the list.
lPush(key: string, ...values: (string | number)[]): number

Parameters

Parameter
Type
Description
key
string
Key name.
...values
(string | number)[]
Value.

Return

Type
Description
number
On success, the length of the list after insertion is returned.

Samples

import redis from "pts/redis";

let client = new redis.Client("redis://:<password>@<host>:6379/0");

export default function main() {
let lPushResp = client.lPush("list", "foo");
console.log(redis lPush ${lPushResp}); // 1
}

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback