SRANDMEMBER
Note
Official reference: SRANDMEMBER.
Read random set members without removing them.
Syntax
SRANDMEMBER key [count]
Positive count returns distinct members; negative counts allow repeats. Omit it for one member.
Results
| Return | Rows | Content |
|---|---|---|
| ResultSet | multiple | ELEMENT field, STRING type |
Example
SADD demo:tags java jdbc
SRANDMEMBER demo:tags 2