/**
 * Advanced LRU Cache with Disk Spillover
 *
 * Features:
 * - Memory-first with automatic disk spillover for large objects
 * - Configurable memory/disk thresholds
 * - Compressed disk storage
 * - Automatic promotion from disk to memory on access
 * - TTL support with lazy expiration
 * - Detailed metrics collection
 *
 * Usage:
 * ```typescript
 * const cache = new AdvancedLRUCache<MyData>({
 *   name: 'my-cache',
 *   maxMemoryEntries: 1000,
 *   maxDiskEntries: 10000,
 *   memoryThresholdBytes: 10 * 1024, // Objects > 10KB go to disk
 *   ttlMs: 60 * 60 * 1000, // 1 hour
 * });
 *
 * await cache.set('key', largeObject);
 * const value = await cache.get('key');
 * ```
 */
import { EventEmitter } from 'events';
export interface AdvancedLRUCacheConfig {
    /** Cache name for identification and disk storage */
    name: string;
    /** Maximum number of entries in memory */
    maxMemoryEntries: number;
    /** Maximum number of entries on disk */
    maxDiskEntries: number;
    /** Objects larger than this (in bytes) are stored on disk */
    memoryThresholdBytes: number;
    /** Time-to-live in milliseconds */
    ttlMs: number;
    /** Base directory for disk cache */
    cacheDir: string;
    /** Enable compression for disk storage */
    compressionEnabled: boolean;
    /** Compression level (1-9) */
    compressionLevel: number;
    /** Enable metrics collection */
    metricsEnabled: boolean;
    /** Auto-promote disk entries to memory on access */
    autoPromote: boolean;
    /** Callback for serialization */
    serialize?: (value: unknown) => string;
    /** Callback for deserialization */
    deserialize?: (data: string) => unknown;
}
export interface CacheEntry<V> {
    key: string;
    value: V;
    sizeBytes: number;
    createdAt: number;
    accessedAt: number;
    expiresAt: number;
    accessCount: number;
    location: 'memory' | 'disk';
}
export interface CacheMetrics {
    name: string;
    memoryEntries: number;
    diskEntries: number;
    memoryHits: number;
    diskHits: number;
    misses: number;
    totalRequests: number;
    hitRate: number;
    memoryHitRate: number;
    diskHitRate: number;
    evictions: number;
    promotions: number;
    demotions: number;
    averageLatencyMs: number;
    p95LatencyMs: number;
    p99LatencyMs: number;
    totalBytesStored: number;
    compressionRatio: number;
}
export declare class AdvancedLRUCache<V = unknown> extends EventEmitter {
    private config;
    private memoryCache;
    private diskIndex;
    private metrics;
    private diskPath;
    private indexPath;
    private initialized;
    private cleanupInterval;
    constructor(config?: Partial<AdvancedLRUCacheConfig>);
    /**
     * Initialize the cache (creates directories, loads disk index)
     */
    initialize(): Promise<void>;
    /**
     * Get a value from the cache
     */
    get(key: string): Promise<V | undefined>;
    /**
     * Set a value in the cache
     */
    set(key: string, value: V, options?: {
        ttlMs?: number;
    }): Promise<void>;
    /**
     * Delete a key from the cache
     */
    delete(key: string): Promise<boolean>;
    /**
     * Check if key exists
     */
    has(key: string): Promise<boolean>;
    /**
     * Get or compute value
     */
    getOrCompute(key: string, computeFn: () => Promise<V>, options?: {
        ttlMs?: number;
    }): Promise<{
        value: V;
        cached: boolean;
    }>;
    /**
     * Clear all entries
     */
    clear(): Promise<void>;
    /**
     * Get cache metrics
     */
    getMetrics(): CacheMetrics;
    /**
     * Reset metrics
     */
    resetMetrics(): void;
    /**
     * Format metrics for display
     */
    formatMetrics(): string;
    /**
     * Dispose resources
     */
    dispose(): Promise<void>;
    private serialize;
    private deserialize;
    private isExpired;
    private isDiskEntryExpired;
    private recordLatency;
    private evictMemoryIfNeeded;
    private evictDiskIfNeeded;
    private writeToDisk;
    private readFromDisk;
    private deleteFromDisk;
    private promoteToMemory;
    private hashKey;
    private loadDiskIndex;
    private saveDiskIndex;
    private cleanup;
}
/**
 * Create a cache optimized for embeddings
 */
export declare function createEmbeddingCache(): AdvancedLRUCache<number[]>;
/**
 * Create a cache optimized for API responses
 */
export declare function createApiResponseCache(): AdvancedLRUCache<unknown>;
/**
 * Create a cache optimized for search results
 */
export declare function createSearchCache(): AdvancedLRUCache<unknown>;
