import type { ILazy, ILazyPromise } from '../lazy/types.js'; import type { IResettableModel } from '../models/types.js'; import { ExpireTracker } from './expire.js'; /** * Calls factory fn to fetch and store some value for a limited time. * * To factory method be called, `current` getter must be accessed. */ export declare class TempoCache { readonly factory: () => T; private _current; readonly tracker: ExpireTracker; constructor(factory: () => T, lifetimeMs: number); get isExpired(): boolean; get current(): T | undefined; } export declare namespace TempoCache { /** * Creates a TempoCache instance which caches `ILazy.value` for a specified time. * * Note a limitation: calling `reset` (or changing the stored value directly in other way) on `lazy` will not affect the value cached by `TempoCache` instance. */ function createFromLazy(lazy: ILazy & IResettableModel, lifetimeMs: number): TempoCache; /** * Creates a TempoCache instance which caches `ILazyPromise.promise` for a specified time. * * Note a limitation: calling `reset` (or changing the stored value directly in other way) on `lazy` will not affect the value cached by `TempoCache` instance. */ function createFromLazyPromise(lazy: ILazyPromise & IResettableModel, lifetimeMs: number): TempoCache>; }