/** Implements a generic cache system with optional expiration for each key-value pair. */ declare class Cache { /** Object to store cache data. */ private _cache; /** Counter for cache hits. */ private _hitCount; /** Counter for cache misses. */ private _missCount; /** Current size of the cache. */ private _size; /** Debug flag to enable logging. */ private _debug; /** * Adds or updates a cache record with a key, value, optional expiration time, and an optional expiration callback. * @param key The key under which to store the value. * @param value The value to store. * @param time Optional time in milliseconds until the record expires. * @param timeoutCallback Optional callback to execute upon expiration of the cache record. * @returns The stored value. */ put(key: string, value: T, time?: number, timeoutCallback?: (key: string, value: T) => void): T; /** * Deletes a cache record by key. * @param key The key of the cache record to delete. * @returns True if the record was found and deleted, false otherwise. */ del(key: string): boolean; /** * Deletes a cache record by key. Used internally. * @param key The key of the cache record to delete. */ private _del; /** Clears all cache records. */ clear(): void; /** * Retrieves the value of a cache record by key. * @param key The key of the cache record to retrieve. * @returns The value of the cache record, or null if not found or expired. */ get(key: string): T | null; /** @returns The current size of the cache. */ size(): number; /** * Enables or disables debug mode. * @param bool True to enable debug mode, false to disable. */ debug(bool: boolean): void; /** @returns The number of cache hits since the last clear. */ hits(): number; /** @returns The number of cache misses since the last clear. */ misses(): number; /** @returns An array of all current cache keys. */ keys(): string[]; /** * Exports the current cache to a JSON string. * @returns A JSON string representing the cache. */ exportJson(): string; /** * Imports cache records from a JSON string. * @param jsonToImport A JSON string representing the cache to import. * @param options Optional settings for the import, such as whether to skip duplicate keys. * @returns The new size of the cache. */ importJson(jsonToImport: string, options?: { skipDuplicates?: boolean; }): number; } /** Exports an instance of the Cache class. */ declare const cacheInstance: Cache; export default cacheInstance; export { Cache }; //# sourceMappingURL=Cache.d.ts.map