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

HyperLogLog

Look up the HyperLogLog commands for approximate distinct counts and their reply types.

A HyperLogLog estimates how many distinct elements it has seen in a small, fixed amount of memory.

Example (Counting Distinct Visitors)

import {  } from "effect";

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

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

  const changed = yield* .("uniques:mon", ["ada", "grace", "linus"]);
const changed: boolean
const estimate = yield* .(["uniques:mon"]);
const estimate: bigint
yield* .("uniques:week", ["uniques:mon", "uniques:tue"]); return { , }; });

pfadd returns true when the estimate changed. pfcount takes a non-empty tuple of keys and returns the estimate for their union as a bigint.

Methods

MethodCommandReply typePurpose
redis.pfaddPFADDbooleanAdd elements; true if the estimate changed.
redis.pfcountPFCOUNTbigintReturn the estimated cardinality of one or more keys.
redis.pfmergePFMERGEvoidMerge several keys into a destination key.

On this page