cache
Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.
cache(
options):PipelineBehaviorTuple<CacheBehavior,CacheBehaviorOptions>
Defined in: packages/pipeline-cache/src/helpers/cache.intent.ts:35
Returns a cache behavior entry for pipeline.wrap() or createPipeline({ globalBehaviors }).
Parameters
Section titled “Parameters”options
Section titled “options”A key factory and cache options, or inheritModuleKey: true
when the behavior’s constructor defaults supply the key factory. The inheritance marker is not
forwarded to the behavior and does not validate module configuration.
Returns
Section titled “Returns”PipelineBehaviorTuple<CacheBehavior, CacheBehaviorOptions>
The behavior class and options tuple.
Keys for authorized responses must separate tenant, principal and permission
scope; prefer createPartitionedCacheKeyFactory for those responses.
Example
Section titled “Example”export const getUsers = pipeline.wrap( { name: 'getUsers', kind: 'query' }, cache({ key: userCacheKey, ttl: 30_000 }),)(loadUsers);
// The key factory comes from the CacheBehavior constructor defaults.const entry = cache({ inheritModuleKey: true, ttl: 30_000 });