Set

SSCAN

Scan a set

Arguments

keybodystringrequired

The key of the set.

cursorbodynumber

The cursor, use 0 in the beginning and then use the returned cursor for subsequent calls.

optionsbodyObject
matchbodystring

Glob-style pattern to filter by members.

countbodynumber

Number of members to return per call.

Response

[number, TMember[]]required

The new cursor and the members. If the new cursor is 0 the iteration is complete.

Example
await redis.sadd("key", "a", "ab","b", "c");const [newCursor, fields] = await redis.sscan("key", 0, { match: "a*"});console.log(newCursor); // likely `0` since this is a very small setconsole.log(fields); // ["a", "ab"]
Loading search…