createCacheAnnotation
Function: createCacheAnnotation()
createCacheAnnotation(
source,options?): {(value,context):void|AnyMethod; (...args): (value,context) =>void|AnyMethod; } &object
Defined in: packages/cache/src/cache.ts:528
Create a cache annotation (method decorator) bound to a given source provider.
The returned decorator caches method results based on keys generated by
methodKeyGenerator and classKeyGenerator. It also exposes utility methods:
clear(target, propertyKey, ...args): Clear specific cache entryclearAll(target, propertyKey?): Clear all or method-prefixed entriesgarbageCollect(): Run TTL-based cleanup
Parameters
source
(target) => object | null
function returning the cache host for a given target
options?
CacheOptions = {}
cache configuration options
Returns
{(value, context): void | AnyMethod; (...args): (value, context) => void | AnyMethod; } & object
the cache method decorator with utility methods