Skip to main content
Swytch Documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Sets and Sorted Sets

Track unique members with a set. Use a sorted set when each member also needs a score, such as a leaderboard or scheduled-work index.

SADD project:42:members alice bob
SISMEMBER project:42:members alice
ZADD leaderboard 100 alice 80 bob
ZRANGE leaderboard 0 -1 WITHSCORES

Set membership does not count duplicate additions. Sorted-set updates change the score associated with a member. Use the supported intersection and union commands to combine collections.

Destructive operations such as SPOP and ZPOPMIN remove state. Handle ambiguous replies before retrying; another successful pop can remove another item.

See the set and sorted-set command references. For shared collections, read local and distributed keys.