mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
getSortedSetRevRangeByLex
This commit is contained in:
@@ -299,9 +299,25 @@ module.exports = function (redisClient, module) {
|
||||
if (max !== '+') {
|
||||
max = '(' + max;
|
||||
}
|
||||
redisClient.zrangebylex([key, min, max, 'LIMIT', start, count], callback);
|
||||
|
||||
sortedSetRangeByLex('zrangebylex', key, min, max, start, count, callback)
|
||||
};
|
||||
|
||||
module.getSortedSetRevRangeByLex = function (key, max, min, start, count, callback) {
|
||||
if (min !== '-') {
|
||||
min = '[' + min;
|
||||
}
|
||||
if (max !== '+') {
|
||||
max = '(' + max;
|
||||
}
|
||||
|
||||
sortedSetRangeByLex('zrevrangebylex', key, max, min, start, count, callback)
|
||||
};
|
||||
|
||||
function sortedSetRangeByLex(method, key, min, max, start, count, callback) {
|
||||
redisClient[method]([key, min, max, 'LIMIT', start, count], callback);
|
||||
}
|
||||
|
||||
module.sortedSetIntersectCard = function (keys, callback) {
|
||||
if (!Array.isArray(keys) || !keys.length) {
|
||||
return callback(null, 0);
|
||||
|
||||
Reference in New Issue
Block a user