computeFanout
Expands a single entity reference into its full set of invalidation tags, from the most-specific leaf tag down to the namespace root, following the hierarchy declared in the schema.
Signature
function computeFanout(schema: CacheSchemaShape<NS, T, Q, E>, input: FanoutInput<T>): string[];Parameters
| Name | Type | Description |
|---|---|---|
schema | CacheSchemaShape<NS, T, Q, E> | |
input | FanoutInput<T> |
Returns
Ordered array of cache tags from leaf to namespace root, suitable for passing to an adapter's invalidate call.
Throws
input.entity is not declared in schema.entities.Example
const tags = computeFanout(productSchema.schema, {
entity: 'product',
tenant: shop,
params: { id: '123' },
});
// ['commerce.acme.product.123', 'commerce.acme.product', 'commerce.acme', 'commerce']Related
ContractTestOptions runAdapterContract AdapterCtx CacheAdapter CacheInstance CacheKey CacheSchema CacheSchemaShape
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
ContractTestOptions
Configuration passed to runAdapterContract; declares how to create and tear down the adapter under test and which optional protocol features the adapter support