/**
 * Persistent Cache Service
 *
 * Extends CacheService with file-based persistence for caching across sessions.
 * Uses a two-level cache: memory (fast) + disk (persistent).
 *
 * @since v1.42.0
 */
import { CacheService } from './cache-service.js';
import type { CacheConfig } from './cache-types.js';
/**
 * Cache entry stored on disk
 */
export interface PersistedCacheEntry<T = unknown> {
    key: string;
    value: T;
    createdAt: number;
    expiresAt: number;
    version: number;
}
/**
 * Persistence backend interface
 */
export interface PersistenceBackend {
    /** Get an entry by key */
    get<T>(key: string): Promise<PersistedCacheEntry<T> | null>;
    /** Set an entry */
    set<T>(key: string, entry: PersistedCacheEntry<T>): Promise<void>;
    /** Delete an entry */
    delete(key: string): Promise<boolean>;
    /** Clear all entries */
    clear(): Promise<void>;
    /** Get all keys */
    keys(): Promise<string[]>;
    /** Get total size in bytes */
    getSize(): Promise<number>;
}
/**
 * File-based persistence backend
 *
 * Stores cache entries as JSON files in a directory structure:
 * cacheDir/
 *   ab/
 *     abcd1234...json
 *   cd/
 *     cdef5678...json
 */
export declare class FilePersistenceBackend implements PersistenceBackend {
    private readonly cacheDir;
    private readonly version;
    constructor(cacheDir: string, version?: number);
    private keyToPath;
    private pathToKey;
    get<T>(key: string): Promise<PersistedCacheEntry<T> | null>;
    set<T>(key: string, entry: PersistedCacheEntry<T>): Promise<void>;
    delete(key: string): Promise<boolean>;
    clear(): Promise<void>;
    keys(): Promise<string[]>;
    getSize(): Promise<number>;
}
/**
 * Persistent cache options
 */
export interface PersistentCacheOptions extends Partial<CacheConfig> {
    /** Cache directory path */
    cacheDir: string;
    /** Cache version (entries with different version are invalidated) */
    cacheVersion?: number;
    /** Write-through: persist on every set (default: true) */
    writeThrough?: boolean;
    /** Read-through: check disk on memory miss (default: true) */
    readThrough?: boolean;
}
/**
 * Persistent Cache Service
 *
 * Two-level cache with memory and disk storage.
 */
export declare class PersistentCacheService extends CacheService {
    private readonly backend;
    private readonly cacheVersion;
    private readonly writeThrough;
    private readonly readThrough;
    constructor(options: PersistentCacheOptions);
    /**
     * Get a value, checking disk if not in memory
     */
    get<T>(key: string, fetcher?: () => Promise<T>): Promise<T | undefined>;
    /**
     * Set a value in both memory and disk
     */
    set<T>(key: string, value: T, options?: {
        ttl?: number;
        tags?: string[];
    }): void;
    /**
     * Async set that waits for persistence
     */
    setAsync<T>(key: string, value: T, options?: {
        ttl?: number;
        tags?: string[];
    }): Promise<void>;
    /**
     * Persist an entry to disk
     */
    private persistEntry;
    /**
     * Invalidate from both memory and disk
     */
    invalidate(key: string): boolean;
    /**
     * Clear both memory and disk
     */
    clear(): void;
    /**
     * Clear disk cache synchronously waiting for completion
     */
    clearAsync(): Promise<void>;
    /**
     * Get all keys from both memory and disk
     */
    allKeys(): Promise<string[]>;
    /**
     * Get disk cache size in bytes
     */
    getDiskSize(): Promise<number>;
    /**
     * Load all disk entries into memory
     */
    warmFromDisk(): Promise<number>;
    /**
     * Persist all memory entries to disk
     */
    flushToDisk(): Promise<number>;
    /**
     * Get extended stats including disk info
     */
    getExtendedStatsWithDisk(): Promise<{
        memory: ReturnType<CacheService['getStats']>;
        disk: {
            entries: number;
            sizeBytes: number;
        };
    }>;
}
/**
 * Get the singleton persistent cache service
 */
export declare function getPersistentCacheService(options?: PersistentCacheOptions): PersistentCacheService;
/**
 * Reset the singleton (for testing)
 */
export declare function resetPersistentCacheService(): void;
//# sourceMappingURL=persistent-cache.d.ts.map