Skip to content

Commit

Permalink
add zrevrangebyscore
Browse files Browse the repository at this point in the history
  • Loading branch information
BeyondWUXF authored Oct 11, 2024
1 parent 0ef04dc commit 1d0155a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/sw/redis++/async_redis.h
Original file line number Diff line number Diff line change
Expand Up @@ -1565,6 +1565,32 @@ class AsyncRedis {
return zrevrangebylex<Output, Interval, Callback>(key, interval, {}, std::forward<Callback>(cb));
}

// TODO: withscores parameter
template <typename Output, typename Interval>
Future<Output> zrevrangebyscore(const StringView &key,
const Interval &interval,
const LimitOptions &opts) {
return _command<Output>(fmt::zrevrangebyscore<Interval>,
key, interval, opts);
}

template <typename Output, typename Interval, typename Callback>
auto zrevrangebyscore(const StringView &key, const Interval &interval, const LimitOptions &opts, Callback &&cb)
-> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<Output> &&>::value, void>::type {
_callback_fmt_command<Output>(std::forward<Callback>(cb), fmt::zrevrangebyscore<Interval>, key, interval, opts);
}

template <typename Output, typename Interval>
Future<Output> zrevrangebyscore(const StringView &key, const Interval &interval) {
return zrevrangebyscore(key, interval, {});
}

template <typename Output, typename Interval, typename Callback>
auto zrevrangebyscore(const StringView &key, const Interval &interval, Callback &&cb)
-> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<Output> &&>::value, void>::type {
return zrevrangebyscore<Output>(key, interval, {}, std::forward<Callback>(cb));
}

Future<OptionalLongLong> zrevrank(const StringView &key, const StringView &member) {
return _command<OptionalLongLong>(fmt::zrevrank, key, member);
}
Expand Down

0 comments on commit 1d0155a

Please sign in to comment.