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

Bitmaps

Look up the bit commands on strings, including bitfield operations and their reply types.

Bitmap commands treat a string as an array of bits. They live on strings, so the keys are ordinary string keys.

Example (Tracking Daily Activity)

import {  } from "effect";

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

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

  const before = yield* .("active:2026-10-29", 42, 1);
const before: 0 | 1
const active = yield* .("active:2026-10-29", 42);
const active: 0 | 1
const total = yield* .("active:2026-10-29");
const total: bigint
return { , , }; });

setbit returns the previous bit and getbit returns the bit, both typed as 0 | 1. Counts and positions are bigint.

Methods

MethodCommandReply typePurpose
redis.setbitSETBIT0 | 1Set the bit at an offset and return its previous value.
redis.getbitGETBIT0 | 1Read the bit at an offset.
redis.bitcountBITCOUNTbigintCount the set bits, optionally within a range.
redis.bitposBITPOSbigintFind the first bit set to 0 or 1.
redis.bitopBITOPbigintCombine bitmaps into a destination key.
redis.bitfieldBITFIELDreadonly Option<bigint>[]Read and write integer fields in a bitmap.
redis.bitfieldRoBITFIELD_ROreadonly bigint[]Read integer fields without writing.

Option types

  • BitRange for bitcount: { start: number | bigint; end: number | bigint; unit?: "BYTE" | "BIT" }.
  • BitPositionRange for bitpos: { start: number | bigint; end?: number | bigint; unit?: "BYTE" | "BIT" }.
  • BitOperation for bitop is "AND" | "OR" | "XOR" | "NOT" | "DIFF" | "DIFF1" | "ANDOR" | "ONE".
  • BitfieldRead is { operation: "GET"; encoding; offset }.
  • BitfieldOperation is a BitfieldRead or a write { operation: "SET" | "INCRBY"; encoding; offset; value; overflow?: "WRAP" | "SAT" | "FAIL" }.

encoding is { signed: true; bits: number } | { signed: false; bits: number }, and offset is a number or { index: number }.