/**
 * High-performance LRU Cache with memory monitoring and automatic cleanup
 * Optimized for large-scale indexing operations with configurable memory limits
 */
export type SizeEstimationMode = 'fast' | 'balanced' | 'accurate';
export interface LRUCacheOptions {
    name?: string;
    maxSize: number;
    maxMemoryMB?: number;
    ttlMs?: number;
    onEviction?: (key: string, value: any) => void;
    onSet?: () => void;
    sizeEstimationMode?: SizeEstimationMode;
}
export interface CacheStats {
    size: number;
    maxSize: number;
    hitCount: number;
    missCount: number;
    evictionCount: number;
    memoryUsageMB: number;
    hitRate: number;
}
export declare class LRUCache<T> {
    private static hasLoggedInit;
    private static logListener?;
    static addLogListener(fn: (level: 'debug' | 'info' | 'warn' | 'error', message: string, data?: Record<string, unknown>) => void): () => void;
    /** Reset static flags for test isolation. */
    static resetStaticState(): void;
    private readonly name;
    private readonly maxSize;
    private readonly maxMemoryBytes;
    private readonly ttlMs;
    private readonly onEviction?;
    private readonly onSet?;
    private readonly sizeEstimationMode;
    private cache;
    private head;
    private tail;
    private currentMemoryBytes;
    private nextExpiryTimestamp;
    private lastActivityTime;
    private hitCount;
    private missCount;
    private evictionCount;
    private static readonly PRIMITIVE_SIZE;
    private static readonly OBJECT_BASE_OVERHEAD;
    private static readonly ARRAY_BASE_OVERHEAD;
    private static readonly FIELD_OVERHEAD;
    private static readonly ELEMENT_ESTIMATE;
    private static readonly BALANCED_SAMPLE_SIZE;
    constructor(options: LRUCacheOptions);
    /**
     * Get value from cache with automatic cleanup
     */
    get(key: string): T | undefined;
    /**
     * Set value in cache with automatic eviction
     */
    set(key: string, value: T, sizeHint?: number): this;
    /**
     * Delete specific key from cache
     */
    delete(key: string): boolean;
    /**
     * Check if key exists in cache
     */
    has(key: string): boolean;
    /**
     * Clear all entries from cache
     */
    clear(): void;
    /**
     * Get current cache size (number of entries)
     */
    get size(): number;
    /**
     * Get cache statistics
     */
    getStats(): CacheStats;
    /**
     * Get all keys in access order (most recent first)
     * Returns an array for compatibility with Map behavior and array indexing
     */
    keys(): string[] & IterableIterator<string>;
    /**
     * Get all values in access order (most recent first)
     * Returns an array for compatibility with Map behavior and array indexing
     */
    values(): T[] & IterableIterator<T>;
    /**
     * Get all entries in access order (most recent first)
     * Returns an array for compatibility with Map behavior and array indexing
     */
    entries(): Array<[string, T]> & IterableIterator<[string, T]>;
    /**
     * Execute a callback for each entry in the cache
     */
    forEach(callback: (value: T, key: string, map: this) => void, thisArg?: any): void;
    /**
     * Iterator for entries (for Map compatibility)
     */
    [Symbol.iterator](): IterableIterator<[string, T]>;
    /**
     * String tag for Map compatibility
     */
    get [Symbol.toStringTag](): string;
    /**
     * Get current memory usage in MB
     */
    getMemoryUsageMB(): number;
    /**
     * Get current memory usage in bytes
     */
    getMemoryUsageBytes(): number;
    /**
     * Get the cache name (set via constructor options)
     */
    getName(): string;
    /**
     * Get the timestamp of the most recent get() hit or set() call.
     * Used by CacheMemoryBudget to identify the coldest (least-active) cache.
     * Returns 0 if the cache has never been accessed.
     */
    getLastActivityTimestamp(): number;
    /**
     * Evict the least recently used entry from the cache.
     * Used by CacheMemoryBudget to enforce global memory limits.
     * @returns true if an entry was evicted, false if the cache was empty
     */
    evictOne(): boolean;
    /**
     * Manually trigger cleanup of expired entries.
     * Recomputes nextExpiryTimestamp from remaining entries.
     */
    cleanup(): number;
    private moveToFront;
    private addToFront;
    private removeNode;
    private evictIfNecessary;
    private evictLeastRecentlyUsed;
    /**
     * Estimates the memory size of a value using configurable accuracy modes:
     * - fast: O(1) heuristics based on type and property count (2-5x faster than JSON.stringify)
     * - balanced: Samples first N properties for better accuracy (moderate speed)
     * - accurate: Uses JSON.stringify for precise size (slowest, original behavior)
     */
    private estimateSize;
    /**
     * Fast O(1) size estimation using heuristics
     * Achieves 2-5x speedup over JSON.stringify with reasonable accuracy (50-200%)
     */
    private estimateSizeFast;
    /**
     * Balanced estimation: Samples first N properties for improved accuracy
     * Provides better accuracy than fast mode with moderate performance cost
     */
    private estimateSizeBalanced;
    /**
     * Accurate estimation using JSON.stringify (original behavior)
     * Slowest but most accurate, O(n) where n is the size of the object
     */
    private estimateSizeAccurate;
}
/**
 * Factory for creating optimized LRU caches for different use cases
 */
export declare class CacheFactory {
    /**
     * Create cache optimized for search results
     */
    static createSearchResultCache<T>(options?: Partial<LRUCacheOptions>): LRUCache<T>;
    /**
     * Create cache optimized for index data
     */
    static createIndexCache<T>(options?: Partial<LRUCacheOptions>): LRUCache<T>;
    /**
     * Create cache optimized for API responses
     */
    static createAPICache<T>(options?: Partial<LRUCacheOptions>): LRUCache<T>;
}
//# sourceMappingURL=LRUCache.d.ts.map