basalt / cache/src / CachePluginOptions
Interface: CachePluginOptions
Defined in: cache/src/index.ts:324
Extends
Properties
driver?
> optional driver?: CacheDriver | "memory"
Defined in: cache/src/index.ts:333
'memory' (default) or a CacheDriver instance.
Redis used to be reachable here as driver: 'redis' with a url, which is why this package depended on ioredis and shipped 1.5 MB to consumers who only ever used the in-memory driver. Use redisCache(url) from @basaltkit/cache-redis instead.
now?
> optional now?: () => number
Defined in: cache/src/index.ts:44
Injectable clock (ms) for stale-while-revalidate windows. Default: Date.now.
Returns
number
Inherited from
onMissingScope?
> optional onMissingScope?: "error" | "global"
Defined in: cache/src/index.ts:42
What to do when the scope function resolves nothing (no tenant in context): 'global' (default) shares one namespace — convenient but a per-tenant value cached without a tenant leaks to others; 'error' fails closed (throws MissingCacheScopeError) on read/write. In a multi-tenant app (or with an explicit 'error'), flush() fails closed too, so a mis-scoped call can't wipe every tenant's cache.
Inherited from
prefix?
> optional prefix?: string
Defined in: cache/src/index.ts:27
Root prefix for all keys. Default: 'basalt'
Inherited from
scope?
> optional scope?: (() => string | undefined) | null
Defined in: cache/src/index.ts:33
Dynamic segment of the prefix, resolved on every operation. The default reads ctx().tenant.id — automatic per-tenant isolation. Pass null to disable (a deliberate global cache).