@btravstack/cache / redis
redis
Classes
CacheConfig
Defined in: packages/cache/src/redis.ts:15
What the graph bound from the environment for the Redis adapter.
Extends
PortInstance<"CacheConfig", {url:string; }>
Constructors
Constructor
new CacheConfig(): CacheConfig;Defined in: packages/di/dist/index.d.mts:16
Returns
Inherited from
Port("CacheConfig")<{ readonly url: string }>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
[ID] | readonly | "CacheConfig" | Port("CacheConfig").[ID] | packages/di/dist/index.d.mts:12 |
[SERVICE] | readonly | object | Port("CacheConfig").[SERVICE] | packages/di/dist/index.d.mts:13 |
[SERVICE].url | readonly | string | - | packages/cache/src/redis.ts:15 |
portId | readonly | "CacheConfig" | Port("CacheConfig").portId | packages/di/dist/index.d.mts:17 |
Variables
redisSchema
const redisSchema: ConfigSchema<Readonly<Record<string, string | undefined>>, {
url: string;
}>;Defined in: packages/cache/src/redis.ts:22
REDIS_URL, required. No default: a cache quietly pointed at localhost would look like it was working. An unset variable is a ConfigInvalid naming it, at graph build.
Functions
redisCache()
function redisCache(): Module<CacheBackend, ConfigInvalid, Env | Scope>;Defined in: packages/cache/src/redis.ts:65
The Redis adapter: one connection, opened with the scope and closed with it, and CacheBackend over it. Nothing here is per call — a client per operation would spend a handshake to save nothing and leave the drain with sockets it does not know about.
Returns
Module<CacheBackend, ConfigInvalid, Env | Scope>
redisCacheBackend()
function redisCacheBackend(client): CacheBackendService;Defined in: packages/cache/src/redis.ts:38
The adapter's service over a connected client. Values are JSON, which is what every other reader of that database already speaks. A value JSON.stringify cannot take is a defect, not a CacheUnavailable: a bug in the caller, and an arm no correct program could reach.
Parameters
| Parameter | Type |
|---|---|
client | RedisClientType |