Skip to content

ICacheLogger

Defined in: packages/ddd-core/persistence/cache/cache-logger.ts:20

Receives the operational warnings of the cache decorators and adapters, such as a failed cache write or a miswired repository.

Pass one through the logger option to route these warnings into an application’s logging. console and a NestJS Logger both fit. Without it, warnings go to console.warn with a [CacheDecorator]-style prefix. A logger that throws never changes a repository result.

@Cache<User, UserSnapshot>({
setKey: (user) => cacheKey(User.aggregateName, { id: user.id }),
logger: new Logger('UserCache'), // NestJS
})

warn(message): unknown

Defined in: packages/ddd-core/persistence/cache/cache-logger.ts:21

string

unknown