Skip to content

@btravstack/cache


@btravstack/cache / redis

redis ​

Classes ​

CacheConnectionFailed ​

Defined in: packages/cache/src/redis.ts:24

The connection could not be opened at all — a wrong REDIS_URL, a server that is not listening, credentials the server refused.

Separate from CacheUnavailable, which is about one operation on one key and carries both: this happens before any key exists. Modeled because it is a startup failure an operator caused and can fix, so it deserves a message and an exit code — see CONNECT_ATTEMPTS for what it replaced, which was neither.

Extends ​

  • TaggedErrorInstance<"CacheConnectionFailed", { reason: string; }>

Constructors ​

Constructor ​
ts
new CacheConnectionFailed(args): CacheConnectionFailed;

Defined in: node_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2386

Parameters ​
ParameterType
argsobject & object
Returns ​

CacheConnectionFailed

Inherited from ​

TaggedError("CacheConnectionFailed")<{ readonly reason: string; }>.constructor

Properties ​

PropertyModifierTypeInherited fromDefined in
_tagreadonly"CacheConnectionFailed"TaggedError("CacheConnectionFailed")._tagnode_modules/.pnpm/unthrown@5.12.1/node_modules/unthrown/dist/index.d.mts:2363
cause?publicunknownTaggedError("CacheConnectionFailed").causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringTaggedError("CacheConnectionFailed").messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("CacheConnectionFailed").namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
reasonreadonlystringTaggedError("CacheConnectionFailed").reasonpackages/cache/src/redis.ts:25
stack?publicstringTaggedError("CacheConnectionFailed").stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076

Functions ​

redisCache() ​

ts
function redisCache(): Module<CacheBackend, CacheConnectionFailed | ConfigInvalid, EnvReading<"REDIS_URL", never> | Scope>;

Defined in: packages/cache/src/redis.ts:158

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, CacheConnectionFailed | ConfigInvalid, EnvReading<"REDIS_URL", never> | Scope>

Released under the MIT License.