mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 08:55:47 +01:00
feat: #7707, added sortedSetAddBulk
This commit is contained in:
@@ -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));
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user