Skip to main content

ZSCAN

Note

Official reference: ZSCAN.

Read one cursor batch of members and scores.

Syntax​

ZSCAN key cursor [MATCH pattern] [COUNT count]

Start with cursor 0. MATCH filters members; COUNT hints at scan work, not a fixed page size.

Results​

ReturnRowsContent
ResultSetmultipleCURSOR field, STRING type
ELEMENT field, STRING type
SCORE field, DOUBLE type
Caution

The cursor is attached to each result row, so empty batches lose the continuation cursor. Use a Redis client for guaranteed complete traversal; an empty batch does not mean completion.

Example​

ZADD demo:ranking 10 alice 20 bob
ZSCAN demo:ranking 0 MATCH a* COUNT 10