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}`); // 1let rPopResp = client.rPop("list");console.log(`redis rPop ${rPopResp}`); // foo}