[ioredis] Add lpop for Cluster (#43005)

Co-authored-by: thmiyathmary <hayato1023_zero_giga@yahoo.co.jp>
This commit is contained in:
thmiyathmary 2020-03-13 07:50:03 +09:00 committed by GitHub
parent d54b71f203
commit 69bc9ed3f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

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>;

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));
});