import { Logger } from '../../utils/logger.js';
/**
 * Cached data wrapper with TTL metadata
 */
export interface CachedData<T> {
    data: T;
    timestamp: number;
    ttl: number;
}
/**
 * Cache statistics for monitoring and debugging
 */
export interface CacheStats {
    totalFiles: number;
    totalSize: number;
    oldestCache: string | null;
    oldestCacheAge: number | null;
    providers: {
        [provider: string]: {
            files: number;
            size: number;
        };
    };
}
/**
 * CacheManager - Manages file-based caching with TTL validation
 *
 * Features:
 * - 24-hour TTL by default (configurable)
 * - Atomic writes (temp file + rename)
 * - Corruption detection and auto-recovery
 * - Per-project cache separation
 * - Thread-safe operations
 *
 * Cache file format:
 * {
 *   "data": <T>,
 *   "timestamp": 1700000000000,
 *   "ttl": 86400000
 * }
 */
export declare class CacheManager {
    private cacheDir;
    private logger;
    private defaultTTL;
    constructor(projectRoot: string, options?: {
        logger?: Logger;
        ttl?: number;
    });
    /**
     * Get cached data if valid (within TTL)
     *
     * @param key Cache key (e.g., "jira-projects", "jira-BACKEND-deps")
     * @returns Cached data or null if cache miss/expired/corrupted
     */
    get<T>(key: string): Promise<T | null>;
    /**
     * Get cached data even if expired (stale cache fallback)
     *
     * Used for rate limit fallback: when API rate limit hit,
     * use stale cache instead of failing
     *
     * @param key Cache key
     * @returns Cached data or null if missing/corrupted (ignores TTL)
     */
    getStale<T>(key: string): Promise<T | null>;
    /**
     * Set cached data with current timestamp and TTL
     *
     * Uses atomic write pattern (temp file + rename) to prevent corruption
     *
     * @param key Cache key
     * @param data Data to cache
     * @param ttl Optional custom TTL (overrides default)
     */
    set<T>(key: string, data: T, ttl?: number): Promise<void>;
    /**
     * Delete cached data
     *
     * @param key Cache key
     */
    delete(key: string): Promise<void>;
    /**
     * Clear all cached data
     */
    clearAll(): Promise<void>;
    /**
     * Get cache statistics for monitoring
     */
    getStats(): Promise<CacheStats>;
    /**
     * Delete caches older than specified age
     *
     * @param maxAgeMs Maximum age in milliseconds
     * @returns Count of deleted caches
     */
    deleteOlderThan(maxAgeMs: number): Promise<number>;
    /**
     * Check if cached data is still valid (within TTL)
     */
    private isValid;
    /**
     * Convert milliseconds to hours (formatted to 1 decimal place)
     */
    private msToHours;
    /**
     * Validate cache structure has required fields
     */
    private isValidCacheStructure;
    /**
     * Get full cache file path for a key
     */
    private getCachePath;
    /**
     * Ensure cache directory exists
     */
    private ensureCacheDir;
    /**
     * Log cache errors to dedicated error log
     */
    private logCacheError;
}
//# sourceMappingURL=cache-manager.d.ts.map