method
RedisClient.zrevrangebyscore
Return members in a sorted set with scores within a given range, ordered from high to low
Returns all the elements in the sorted set at key with a score between max and min (note: max comes before min). The elements are considered to be ordered from high to low scores.
Score ranges support:
-infand+inffor negative and positive infinity(prefix for exclusive bounds (e.g.,(5means less than 5, not including 5)
The sorted set key
Maximum score (can be "+inf", a number, or prefixed with "(" for exclusive)
Minimum score (can be "-inf", a number, or prefixed with "(" for exclusive)
Promise that resolves with array of members
await redis.send("ZADD", ["myzset", "1", "one", "2", "two", "3", "three"]);
const members = await redis.zrevrangebyscore("myzset", 2, 1);
// Returns: ["two", "one"]Return members in a sorted set with scores within a given range, ordered from high to low, with scores
The sorted set key
Maximum score
Minimum score
The "WITHSCORES" keyword to return scores along with members
Promise that resolves with array of [member, score, member, score, ...]
await redis.send("ZADD", ["myzset", "1", "one", "2", "two", "3", "three"]);
const result = await redis.zrevrangebyscore("myzset", 2, 1, "WITHSCORES");
// Returns: ["two", "2", "one", "1"]Return members in a sorted set with scores within a given range, ordered from high to low, with pagination
The sorted set key
Maximum score
Minimum score
The "LIMIT" keyword
The number of elements to skip
The maximum number of elements to return
Promise that resolves with array of members
Return members in a sorted set with scores within a given range, ordered from high to low, with options
The sorted set key
Maximum score
Minimum score
Additional options (WITHSCORES, LIMIT offset count)
Promise that resolves with array of members (and scores if WITHSCORES is used)