how to get a member with maximum (or minimum ) score from redis sorted set given a subset of members?
Member with minimum score:
ZRANGEBYSCORE myset -inf +inf WITHSCORES LIMIT 0 1
Member with maximum score:
ZREVRANGEBYSCORE myset +inf -inf WITHSCORES LIMIT 0 1
Sorted set element with lowest score:
ZRANGE key 0 0 WITHSCORES
Sorted set element with highest score:
ZREVRANGE key 0 0 WITHSCORES
Time complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned.
Docs: https://redis.io/commands/zrange; https://redis.io/commands/zrevrange