ZRANDMEMBER
Note
Official reference: ZRANDMEMBER.
Read random members, optionally with scores.
Syntax
ZRANDMEMBER key [count [WITHSCORES]]
Omit count for one member; positive counts return distinct members and negative counts allow repeats. WITHSCORES must follow count.
Results
| Return | Rows | Content |
|---|---|---|
| ResultSet | multiple | ELEMENT field, STRING type SCORE field, DOUBLE type (when using WITHSCORES) |
Example
ZADD demo:ranking 10 alice 20 bob
ZRANDMEMBER demo:ranking 2 WITHSCORES