CacheBehaviorOptions
Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.
Defined in: packages/pipeline-cache/src/interfaces/cache-options.interface.ts:68
Per-handler caching options, supplied through pipeline.wrap(options, [CacheBehavior, options])
and/or as defaults, the second argument of the CacheBehavior constructor.
Example
Section titled “Example”class GetUserHandler { @pipeline.wrap({ kind: 'query' }, [CacheBehavior, { key: createPartitionedCacheKeyFactory({ principal: (ctx) => ctx.items.get('userId') as string | undefined, scope: (ctx) => ctx.items.get('capabilityVersion') as string | undefined, }), ttl: 60_000, }]) async handle(query: GetUserQuery) {}}Properties
Section titled “Properties”condition?
Section titled “condition?”
optionalcondition?:CacheCondition
Defined in: packages/pipeline-cache/src/interfaces/cache-options.interface.ts:86
Optional predicate gating whether a given request is cached.
failOpen?
Section titled “failOpen?”
optionalfailOpen?:boolean
Defined in: packages/pipeline-cache/src/interfaces/cache-options.interface.ts:93
When a cache read or write throws, bypass the cache and continue (true,
default) or propagate the store error (false). A failed read bypasses the
write for that execution. This option does not catch key, condition, or
downstream handler errors.
optionalkey?:CacheKeyFactory
Defined in: packages/pipeline-cache/src/interfaces/cache-options.interface.ts:84
Cache-key factory. Required when this behavior runs — there is no default.
A cache hit returns without executing the handler, so the key must partition
every dimension that can change the authorized response: tenant, principal,
permission scope and request payload. Use createPartitionedCacheKeyFactory
rather than composing one by hand.
kinds?
Section titled “kinds?”
optionalkinds?: ("command"|"query"|"event"|"unknown")[]
Defined in: packages/pipeline-cache/src/interfaces/cache-options.interface.ts:73
Request kinds eligible for caching. Defaults to ['query'] so that
commands and events bypass the cache automatically.
optionalttl?:number
Defined in: packages/pipeline-cache/src/interfaces/cache-options.interface.ts:75
Time-to-live (milliseconds) for entries written by this handler.