Documentation for agents: an index at /llms.txt, every docs page in one file at /llms-full.txt, and Markdown for any docs page by adding .md to its URL.

Effect KitRedis

Sets

Look up the set commands, including set algebra, with their commands and reply types.

Set commands store unique members. Members are bytes, and membership checks return boolean.

Example (Tracking Unique Visitors)

import {  } from "effect";

import {  } from "@effect-kit/redis";

const  = .(function* () {
  const  = yield* ;

  const added = yield* .("visitors:mon", ["ada", "grace", "linus"]);
const added: bigint
const seen = yield* .("visitors:mon", "ada");
const seen: boolean
const both = yield* .(["visitors:mon", "visitors:tue"]);
const both: readonly Uint8Array<ArrayBufferLike>[]
return { , , }; });

Methods

MethodCommandReply typePurpose
redis.saddSADDbigintAdd members and return how many were new.
redis.sremSREMbigintRemove members and return how many were removed.
redis.scardSCARDbigintCount the members.
redis.smembersSMEMBERSreadonly Uint8Array[]List every member.
redis.sismemberSISMEMBERbooleanCheck whether a value is a member.
redis.smismemberSMISMEMBERreadonly boolean[]Check several values at once.
redis.spopSPOPOption<Uint8Array>Remove and return one random member.
redis.spopCountSPOPreadonly Uint8Array[]Remove and return several random members.
redis.srandmemberSRANDMEMBEROption<Uint8Array>Return one random member.
redis.srandmemberCountSRANDMEMBERreadonly Uint8Array[]Return several random members.
redis.smoveSMOVEbooleanMove a member from one set to another.
redis.sdiffSDIFFreadonly Uint8Array[]Return the difference of sets.
redis.sinterSINTERreadonly Uint8Array[]Return the intersection of sets.
redis.sunionSUNIONreadonly Uint8Array[]Return the union of sets.
redis.sdiffstoreSDIFFSTOREbigintStore the difference of sets in a key.
redis.sinterstoreSINTERSTOREbigintStore the intersection of sets in a key.
redis.sunionstoreSUNIONSTOREbigintStore the union of sets in a key.
redis.sdiffcardSDIFFCARDbigintCount the difference of sets.
redis.sintercardSINTERCARDbigintCount the intersection of sets, with an optional limit.
redis.sunioncardSUNIONCARDbigintCount the union of sets.
redis.sscanSSCANScanPage<Uint8Array>Read one cursor page of members.

SetCardinalityOptions

sdiffcard and sintercard take { limit?: number | bigint }. sunioncard also accepts approximate.

Prop

Type

redis.sscan takes a cursor and ScanOptions and returns a ScanPage<Uint8Array>. redis.scanSet streams the whole set. See Scanning.