Optional
cacheOptional
deepDeep clone the object returned by this method using JSON stringify/parse. If the object is a class all prototyped context is lost.
false
Optional
immutableThe result return by the original function will be immutable. This calls object.freeze which will prevent the returned value from being altered in anyway; this also prevents the object from modifying itself. Only use this when the both the current method nor the callers can change the object.
false
Optional
scopeScope of the cache, defaults to instance for non-static members and global for static methods
'instance'
Optional
ttlCache lifetime in seconds. Undefined, 0 or -1 are considered infinite or until the instance is removed When not set the cached value will never expire.
Optional
unwrapWhen true
and the result of a function is a Promise<T>
cache hits will return the value (of type T
) that the promise resolved to instead of the resolved promise.
This benefits ES6 async-await code by avoiding yielding control back to the event loop but is incompatible with classic Promisees where .then
or .catch
is used as the unwrapped value will not implement these values.
false
When true promise rejections and errors thrown by the cached function will also be cached instead of re-executing.