compose
Chains multiple CacheAdapter implementations into one, reading from adapters in priority order
until a hit is found and fanning writes and invalidations out to all of them. Adapter errors are
caught, logged, and swallowed rather than propagated so a failing secondary never blocks a read.
Signature
function compose(adapters: CacheAdapter[]): CacheAdapter;Parameters
| Name | Type | Description |
|---|---|---|
adapters | CacheAdapter[] |
Returns
A composite CacheAdapter that delegates every operation to all supplied backends.
Example
const adapter = compose(
memoryAdapter({ maxEntries: 200 }),
redisAdapter({ url: process.env.REDIS_URL }),
);
const cache = createCacheInstance(mySchema, adapter);Related
ContractTestOptions runAdapterContract AdapterCtx CacheAdapter CacheInstance CacheKey CacheSchema CacheSchemaShape
CacheSchema
Opaque wrapper returned by defineCache; wraps the resolved CacheSchemaShape to prevent callers from constructing or mutating the shape directly after validation
computeFanout
Expands a single entity reference into its full set of invalidation tags, from the mostspecific leaf tag down to the namespace root, following the hierarchy dec