/**
 * Registry Cache Manager
 *
 * Manages local caching of registry metadata with TTL and staleness handling.
 * Uses filesystem-based JSON cache with atomic writes.
 *
 * @module registry/cache/cache-manager
 * @version 2.0.0
 */
import type { RegistryResponse } from '../types/index.js';
/**
 * Cache metadata
 */
export interface CacheMetadata {
    /** When the cache was created */
    createdAt: string;
    /** When the cache expires (TTL) */
    expiresAt: string;
    /** Cache version for compatibility checks */
    version: string;
    /** Registry endpoint this cache came from */
    endpoint: string;
}
/**
 * Cached registry data
 */
export interface CachedData {
    /** Cache metadata */
    metadata: CacheMetadata;
    /** Cached registry response */
    data: RegistryResponse;
}
/**
 * Cache manager configuration
 */
export interface CacheConfig {
    /** Cache directory (default: ~/.specverse/cache) */
    cacheDir?: string;
    /** TTL in milliseconds (default: 24 hours) */
    ttl?: number;
    /** Cache version */
    version?: string;
    /** Enable cache (default: true) */
    enabled?: boolean;
}
/**
 * Registry Cache Manager
 *
 * Provides filesystem-based caching for registry metadata.
 */
export declare class CacheManager {
    private config;
    private cacheFile;
    constructor(config?: CacheConfig);
    /**
     * Read cache from disk
     *
     * @returns Cached data or null if not found/expired
     */
    read(): Promise<CachedData | null>;
    /**
     * Write cache to disk
     *
     * @param data - Registry data to cache
     * @param endpoint - Registry endpoint URL
     */
    write(data: RegistryResponse, endpoint: string): Promise<void>;
    /**
     * Check if cache is valid (not expired)
     *
     * @param cached - Cached data to check
     * @returns True if cache is still valid
     */
    isValid(cached: CachedData): boolean;
    /**
     * Check if cache is stale (expired but still usable as fallback)
     *
     * @param cached - Cached data to check
     * @returns True if cache is expired
     */
    isStale(cached: CachedData): boolean;
    /**
     * Get cache age in milliseconds
     *
     * @param cached - Cached data to check
     * @returns Age in milliseconds
     */
    getAge(cached: CachedData): number;
    /**
     * Get time until expiration in milliseconds
     *
     * @param cached - Cached data to check
     * @returns Time until expiration (negative if expired)
     */
    getTimeToExpiration(cached: CachedData): number;
    /**
     * Clear cache
     */
    clear(): Promise<void>;
    /**
     * Check if cache exists
     *
     * @returns True if cache file exists
     */
    exists(): Promise<boolean>;
    /**
     * Get cache file path
     *
     * @returns Absolute path to cache file
     */
    getCacheFile(): string;
    /**
     * Get cache configuration
     *
     * @returns Current cache configuration
     */
    getConfig(): Required<CacheConfig>;
    /**
     * Update cache configuration
     *
     * @param config - Partial configuration to merge
     */
    updateConfig(config: Partial<CacheConfig>): void;
}
/**
 * Cache error class
 */
export declare class CacheError extends Error {
    cause?: any;
    constructor(message: string, cause?: any);
}
//# sourceMappingURL=cache-manager.d.ts.map