CacheInstance

tagtree · /core·interface

Fully-typed runtime handle returned by createCacheInstance; binds a cache schema, a storage adapter, and derived key/invalidation helpers into a single callable surface.

Properties

invalidate
keys
KeyFactory<T, Q, E>
schema
CacheSchemaShape<NS, T, Q, E>
invalidateRaw
unknown
read
unknown

Example

const cache = createCacheInstance(productSchema, memoryAdapter());
const key = cache.keys.product({ tenant: shop, id: '123' });
const data = await cache.wrap(key, () => fetchProduct('123'), { ttl: 300 });
await cache.invalidate.product({ tenant: shop, id: '123' });

ContractTestOptions runAdapterContract AdapterCtx CacheAdapter CacheKey CacheSchema CacheSchemaShape EntityDecl

Sourcecache.ts:41Edit the JSDoc directly

On this page