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

Overview

Find which service and page covers each command family, and how a method name maps to a command and reply.

This reference lists the commands that ship with @effect-kit/redis: the method on its service, the Redis command it sends and the success type it returns. Each family page also has the option types that family uses. The tables are written by hand for now and list only methods that exist in the published types.

FamilyServiceCovers
StringsRedisget, set, counters, ranges, multi-key writes
HashesRedisFields, increments, field expiry
ListsRedis, RedisSessionsPush, pop, move, blocking pops
SetsRedisMembers, set algebra
Sorted setsRedis, RedisSessionsScores, ranges, algebra, blocking pops
Keys and expiryRedisDelete, rename, copy, sort, expiry, scan
GeoRedisCoordinates and radius or box search
BitmapsRedisBits and bitfields
HyperLogLogRedisApproximate distinct counts
StreamsRedis, RedisSessionsEntries, consumer groups, reads
Pub/SubRedis, RedisPubSubPublish, inspect, subscribe
ScriptingRedis, RedisScriptsLua scripts and functions
AdministrationRedisAdminServer, ACL, config, clients, diagnostics

Commands for JSON, Search, TimeSeries, probabilistic structures and vector sets are also methods on Redis. They are covered in Modules.

How a method maps to a command

A method name is the Redis command in lowercase, so redis.zadd sends ZADD. Subcommands are joined in camel case: objectEncoding sends OBJECT ENCODING, xgroupCreate sends XGROUP CREATE, and scriptLoad sends SCRIPT LOAD.

A suffix means the same command with a different reply shape or form:

  • WithScores, WithValues and With add the details to each element: zrange and zrangeWithScores.
  • Count returns several elements where the plain method returns one: lpop and lpopCount.
  • Bytes and Text choose the representation: get returns text and getBytes returns bytes.
  • Ro is the read-only form: sortRo, georadiusRo.
  • Store writes the result to a key instead of returning it.

Each command method has a pure Commands.* value with the same name. Pass it to redis.execute, redis.pipeline or redis.transaction. See Commands.

Example (One Command Written Two Ways)

import {  } from "effect";

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

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

  const viaMethod = yield* .("scores");
const viaMethod: bigint
const viaValue = yield* .(Commands.("scores"));
const viaValue: bigint
return [, ] as ; });

How a reply maps to a type

The success type depends on what the command returns. Errors are in the error channel, and a missing key is a value, not an error.

Redis replyTypeExample
Integer count or lengthbiginthlen, llen, del, xlen
Integer flag (0 or 1)booleansismember, hexists, expire
Bit0 | 1getbit, setbit
Simple string OKvoidmset, rename, ltrim
Nil or valueOption<A>get, lpop, zrank
Bulk stringUint8Arraygetrange, lcs
Arrayreadonly A[]lrange, smembers
Field and value pairsreadonly (readonly [Uint8Array, Uint8Array])[]hgetall
Score or decimalstring (decimal text)zincrby, incrbyfloat, hincrbyfloat
Cursor pageScanPage<A>scan, hscan, sscan, zscan
Script or function resultA from the decoder you passevalScript, fcall

Stored values come back as Uint8Array, except get, hgetText and typed keys, which decode UTF-8 text. Nothing is JSON-encoded unless you ask. See Typed values.

Some Redis methods run commands rather than being one command:

MethodPurpose
redis.execute(command)Run any Command value.
redis.executePrepared(prepared)Run a PreparedCommand.
redis.pipeline(commands)Send commands in one round trip. See Pipelines.
redis.transaction(commands)Run commands in MULTI/EXEC. See Transactions.
redis.raw(tokens, contract)Send raw tokens and get a RespValue.

Blocking commands, WATCH, subscriptions and MONITOR are not on Redis because they hold a connection. They are on RedisSessions, RedisPubSub and RedisMonitor. See Sessions.