CacheOptions
Defined in: packages/ddd-core/persistence/decorators/cache.decorator.ts:53
Options for configuring write-through and eviction caching via Cache.
Type Parameters
Section titled “Type Parameters”TEntity
Section titled “TEntity”TEntity = unknown
Properties
Section titled “Properties”barrierTtl?
Section titled “barrierTtl?”
optionalbarrierTtl?:number
Defined in: packages/ddd-core/persistence/decorators/cache.decorator.ts:93
Lifetime in milliseconds of the CacheMutationBarrier written on deletions and secondary invalidations.
A barrier only has to outlive the in-flight reads/writes it guards against, so configure this above the expected maximum repository operation latency. Ignored by IVersionedCache adapters, which fence concurrent fills by revision instead of by barrier.
Default
Section titled “Default”deleteKeys?
Section titled “deleteKeys?”
optionaldeleteKeys?: ((entity) =>string[]) |null
Defined in: packages/ddd-core/persistence/decorators/cache.decorator.ts:63
Function deriving keys to evict when save() returns null or undefined (e.g. deletion).
invalidateKeys?
Section titled “invalidateKeys?”
optionalinvalidateKeys?: ((entity) =>string[]) |null
Defined in: packages/ddd-core/persistence/decorators/cache.decorator.ts:68
Optional secondary keys to evict on every successful save before writing the new entry.
isNewer?
Section titled “isNewer?”
optionalisNewer?: ((cached,incoming) =>boolean) |null
Defined in: packages/ddd-core/persistence/decorators/cache.decorator.ts:80
Optional version comparison function for CAS-safe write-through caching.
If omitted, defaults to isCacheNewer which compares version, __gen, or updatedAt.
Pass null to skip the isNewer comparison.
logger?
Section titled “logger?”
optionallogger?:ICacheLogger
Defined in: packages/ddd-core/persistence/decorators/cache.decorator.ts:99
Receives cache-maintenance warnings. Defaults to console.warn with a
[CacheDecorator] prefix. See ICacheLogger.
setKey?
Section titled “setKey?”
optionalsetKey?: ((entity) =>string) |null
Defined in: packages/ddd-core/persistence/decorators/cache.decorator.ts:58
Function deriving the cache key to write on success.
Pass null or omit to skip write-through caching.
optionalttl?:number
Defined in: packages/ddd-core/persistence/decorators/cache.decorator.ts:73
Optional time-to-live in milliseconds for the write-through cache entry.