Skip to content

Tankōbon / main/services/cloud-files / withTtlCache

Function: withTtlCache() ​

withTtlCache<T>(compute, ttlMs, now?, max?): (key) => Promise<T>

Defined in: main/services/cloud-files.ts:39

compute remembered for ttlMs per key (the last max keys), so a burst of identical questions starts one process. Pure apart from now, which the tests move.

Type Parameters ​

T ​

T

Parameters ​

compute ​

(key) => Promise<T>

ttlMs ​

number

now? ​

() => number

max? ​

number = ONLINE_ONLY_CACHE_SIZE

Returns ​

(key) => Promise<T>