import { Operation, OperationResult } from "@myycontext/core";
import { OperationFingerprintService } from "./OperationFingerprint";
/**
 * Cache entry: Stores operation result with metadata
 */
export interface CacheEntry {
    fingerprint: string;
    operationId: string;
    operationType: string;
    result: OperationResult;
    context: {
        fileHashes: Record<string, string>;
        timestamp: string;
        durationMs: number;
    };
    metadata: {
        hits: number;
        lastAccessed: string;
        createdAt: string;
        expiresAt?: string;
    };
}
/**
 * Cache statistics
 */
export interface CacheStats {
    totalEntries: number;
    totalHits: number;
    totalMisses: number;
    hitRate: number;
    cacheSize: number;
    oldestEntry?: string;
    newestEntry?: string;
}
/**
 * Cache invalidation reason
 */
export type InvalidationReason = "expired" | "file-changed" | "manual" | "cache-full";
/**
 * OperationCache Service
 * Provides caching and replay capabilities for operations
 */
export declare class OperationCache {
    private baseDir;
    private cachePath;
    private cache;
    private fingerprintService;
    private stats;
    private maxCacheSize;
    private defaultTTL;
    private maxEntries;
    constructor(baseDir?: string, fingerprintService?: OperationFingerprintService);
    /**
     * Initialize: Load cache from disk
     */
    init(): Promise<void>;
    /**
     * Get cached result for operation
     */
    get(op: Operation): Promise<OperationResult | null>;
    /**
     * Set cache entry for operation
     */
    set(op: Operation, result: OperationResult, durationMs: number): Promise<void>;
    /**
     * Check if operation result is cached
     */
    has(op: Operation): Promise<boolean>;
    /**
     * Invalidate cache entry
     */
    invalidate(fingerprint: string, reason: InvalidationReason): Promise<void>;
    /**
     * Invalidate all entries for a specific operation type
     */
    invalidateByType(operationType: string): Promise<number>;
    /**
     * Invalidate all entries that touch a specific file
     */
    invalidateByFile(filePath: string): Promise<number>;
    /**
     * Clear all cache entries
     */
    clear(): Promise<void>;
    /**
     * Clean expired entries
     */
    cleanExpired(): Promise<number>;
    /**
     * Get cache statistics
     */
    getStats(): Promise<CacheStats>;
    /**
     * Get all cache entries (for debugging)
     */
    getAll(): CacheEntry[];
    /**
     * Capture file hashes for cache validation
     */
    private captureFileHashes;
    /**
     * Check if files have changed since cache entry was created
     */
    private checkFileChanges;
    /**
     * Get files affected by operation
     */
    private getAffectedFiles;
    /**
     * Evict oldest cache entry
     */
    private evictOldest;
    /**
     * Get cache file size
     */
    private getCacheSize;
    /**
     * Persist cache to disk
     */
    private persist;
    /**
     * Configure cache settings
     */
    configure(options: {
        maxCacheSize?: number;
        defaultTTL?: number;
        maxEntries?: number;
    }): void;
}
//# sourceMappingURL=OperationCache.d.ts.map