Client.rPop

最近更新时间:2024-11-29 11:04:52

我的收藏
rPop 方法用于移除并获取列表的最后一个元素。
rPop(key: string): string

参数

参数
类型
描述
key
string
键名

返回

类型
描述
string
成功时,返回列表中的最后一个元素

样例

import redis from "pts/redis";

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

export default function main() {
let rPushResp = client.rPush("list", "foo");
console.log(`redis rPush ${rPushResp}`); // 1
let rPopResp = client.rPop("list");
console.log(`redis rPop ${rPopResp}`); // foo
}