[ioredis] Add lpop for Cluster (#43005)

Co-authored-by: thmiyathmary <hayato1023_zero_giga@yahoo.co.jp>
This commit is contained in:
thmiyathmary
2020-03-12 15:50:03 -07:00
committed by GitHub
co-authored by thmiyathmary
parent d54b71f203
commit 69bc9ed3f0
2 changed files with 15 additions and 0 deletions
+3
View File
@@ -1326,6 +1326,9 @@ declare namespace IORedis {
rpushBuffer(key: string, ...values: Buffer[]): Promise<number>;
lpop(key: KeyType, callback: (err: Error, res: string) => void): void;
lpop(key: KeyType): Promise<string>;
lpopBuffer(key: KeyType, callback: (err: Error, res: Buffer) => void): void;
lpopBuffer(key: KeyType): Promise<Buffer>;
+12
View File
@@ -278,6 +278,18 @@ cluster.decr('key', (err, data) => {
// [null, '100']
});
listData.forEach(value => {
cluster.rpush('bufferlist', Buffer.from(value));
});
listData.forEach(value => {
cluster.lpop('bufferlist', (err, data) => {
if (data !== value) {
console.log(data);
}
});
});
listData.forEach(value => {
cluster.rpushBuffer('bufferlist', Buffer.from(value));
});