import { IAdequateCacheOptions } from './options'; /** * Entirely adequate node.js in-memory cache with lru and ttl support */ export declare class AdequateCache { private _options; private _data; private _head; private _tail; /** * Source of time information */ private _now; private _ttlCount; private _lastVacuumAt; private _pendingVacuum; private _providerPromises; constructor(userSuppliedOptions?: IAdequateCacheOptions); /** * Returns true if cache contains value at given key. * Note that there is no performance benefit to calling this over get(), it's just a convenience method. */ has(key: string | number): boolean; /** * Get value at key, or return undefined */ get(key: string | number): TValue | undefined; /** * Set value at key. Optionally set ttl for this particular key, otherwise use the global default. * If value is undefined, the key is deleted from cache. * @param key * @param value * @param ttl Set TTL specifically for this key */ set(key: string | number, value: TValue, ttl?: number): boolean; /** * Delete value at key. Returns true if value was in the cache, false if not. */ del(key: string | number): boolean; /** * Empty out all keys, reverting the cache to clear state. */ emptyOut(): void; /** * Returns value if it is already in cache. Otherwise, calls the "provider" method (that must be given * through options) and stores the value in cache, before returning it. */ provide(...args: TProviderArgs): Promise; /** * Returns an iterator of all the keys currently in cache. * Performs vacuum beforehand, so the keys you get are guaranteed * to be actually non-expired. Keys are provided converted to string. */ keys(): IterableIterator; /** * Number of items in cache * Performs vacuum beforehand, so the count you get is guaranteed * to be actually non-expired. */ get size(): number; private _doDelete; /** * Attach entry to internal linked list head. */ private _attachToHead; /** * Detach entry from the linked list. It stays in the lookup. */ private _detach; /** * Try schedule or perform a vacuum */ private _tryVacuum; /** * Clean up expired keys, clean up overflowing keys */ private _vacuum; }