tencent cloud

Client.lPop
Last updated: 2025-03-11 20:05:00
Client.lPop
Last updated: 2025-03-11 20:05:00
The lPop method is used to remove and obtain the first element of the list.
lPop(key: string): string

Parameters

Parameter
Type
Description
key
string
Key name.

Return

Type
Description
string
On success, the first element in the list 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
let lPopResp = client.lPop("list");
console.log(redis lPop ${lPopResp}); // foo
}

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

Feedback