RedisCacheOptions
Defined in: src/cache/RedisCache.ts:28
Redis-backed Cache — wraps ioredis. We pick ioredis over the
official redis client because it’s better typed, supports Redis
Cluster out of the box, and is the de-facto choice in the Node
ecosystem. ioredis is a lazy optional peer dependency: it’s
imported on first cache operation, so users who don’t reach for the
Redis backend pay nothing.
Values are JSON-serialized on set, JSON-parsed on get. This matches 95% of cache use-cases (config, response bodies, counters). Binary payloads or other formats need a custom Cache implementation — deliberately out of scope for v1.
Connection failures do not throw from get — they return None.
The caller’s recovery path (re-fetch from source-of-truth) is the
right behaviour for a cache miss. set and delete swallow
transient errors too, since lost cache writes are tolerable by
definition. incr and setIfAbsent do throw because the caller
relies on their atomic semantics for correctness (rate-limit,
idempotency-key).
Properties
Section titled “Properties”client?
Section titled “client?”
readonlyoptionalclient?:RedisClientLike
Defined in: src/cache/RedisCache.ts:47
Pre-built ioredis client — bypass internal construction (advanced usage: connection sharing, custom retry strategies, Redis Cluster).
readonlyoptionaldb?:number
Defined in: src/cache/RedisCache.ts:37
readonlyoptionalhost?:string
Defined in: src/cache/RedisCache.ts:34
keyPrefix?
Section titled “keyPrefix?”
readonlyoptionalkeyPrefix?:string
Defined in: src/cache/RedisCache.ts:42
Optional key prefix prepended to every key. Useful when a single Redis instance is shared by multiple actor systems / environments.
password?
Section titled “password?”
readonlyoptionalpassword?:string
Defined in: src/cache/RedisCache.ts:36
readonlyoptionalport?:number
Defined in: src/cache/RedisCache.ts:35
readonlyoptionalurl?:string
Defined in: src/cache/RedisCache.ts:33
Redis URL (e.g. redis://localhost:6379) — passed straight to the
ioredis constructor. Mutually exclusive with host/port.