-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Description
Since redis does not support expiring set members, one common pattern is to use ordered sets instead and ZREMRANGEBYSCORE -inf $now to delete expired keys periodically (see #135).
My use case requires choosing N distinct elements from an ordered set at random, which is not supported by ordered sets currently, i.e. ZRANDMEMBER doesn't exist.
I think ZRANDMEMBER shall have the following signature:
ZRANDMEMBER key [count] [min max]
where min and max are both inclusive and allow minus/plus infinity (which are also their default values, respectively).
ZRANDMEMBER shall return abs(count) elements (whose semantics are the same as SRANDMEMBER) from the ordered set key where each returned element has a score s between min and max (inclusive).
I'd be happy to implement it too if anyone is willing to supervise.