Skip to content

Type Alias: WrapOptions<T> ​

WrapOptions<T> = object

The options of Cacher.wrap.

Type Parameters ​

T ​

T = any

Properties ​

refreshThreshold? ​

optional refreshThreshold?: number | ((value) => number)

When a cached value has less time to live than this, in milliseconds, wrap() returns it and recomputes it in the background; or a function of the cached value returning it. Ignored for the entries which never expire.

Default ​

the cache's refreshThreshold option (no background refresh without it)


ttl? ​

optional ttl?: number | ((value) => number)

The time to live of the computed value, in milliseconds (0 never expires), or a function of the value returning it.

Default ​

the cache's ttl option (never expires without it)

Released under the MIT License.