export declare class LruTemporisedAsyncCache { private readonly maxCacheSize; private readonly lifetimeForValue; private readonly nodesMap; private firstNode; private lastNode; private sequentialJobId; /** * @param maxCacheSize Maximum size of the cache. Any value <= 0 is considered as no limit. * @param lifetimeForValue Get the maximum lifetime for an entry given its value, in milliseconds. */ constructor(maxCacheSize: number, lifetimeForValue: (value: V) => number); /** * Get a value if there is an already cached value or job for the provided key. * - If the job is in progress this will return the job promise. * - If there is already a cached value returns the value, regardless of whether his lifetime is expired or not. * - If there is no job nor cached value this will return undefined. * @param key key of the entry * @return if there is a cached value or job in progress for the entry returns the item and if its lifetime has expired, otherwise returns * undefined. */ getIfCachedJob(key: K): Promise<{ item: V; expired: boolean; } | undefined>; /** * Gets a cached value or retrieves it and caches it if the value is not available or if it is available but expired. A value will never be expired * if it was not yet retrieved, even if the retrieved value would be expired according to the {@link additionalExpirationCondition} * @param key key of the entry * @param retrieve given the previous value (if available, expired but not yet removed) of the entry retrieves an updated value. * @param additionalExpirationCondition an expiration condition for already cached values to consider in addition to time-based expiration. Returns * always false by default, meaning the value is not expired if its lifetime didn't already surpass the maximum lifetime. * @return the cached value if present and not expired, else the retrieved value. */ get(key: K, retrieve: (previousValue: V | undefined) => Promise<{ item: V; onEviction?: (isReplacement: boolean) => void; }>, additionalExpirationCondition?: (value: V) => boolean): Promise; /** * Fully empties this cache. * @param doOnEvictionOfCleared if true the onEviction triggers for the retrieved and cached data will be executed, otherwise not. onEviction * triggers of data for which the retrieval jobs were not completed will automatically be called when the job completes. */ clear(doOnEvictionOfCleared?: boolean): void; private addToTail; private evict; private markUsed; private registerJob; private nextJobId; }