feat: #7707, added sortedSetAddBulk

This commit is contained in:
Barış Soner Uşaklı
2019-06-24 17:48:13 -04:00
parent e48c7cd717
commit 3ecd703ea3
5 changed files with 106 additions and 35 deletions

View File

@@ -69,4 +69,15 @@ module.exports = function (redisClient, module) {
callback(err);
});
};
module.sortedSetAddBulk = function (data, callback) {
if (!Array.isArray(data) || !data.length) {
return setImmediate(callback);
}
var batch = redisClient.batch();
data.forEach(function (item) {
batch.zadd(item[0], item[1], item[2]);
});
batch.exec(err => callback(err));
};
};