/** * Registry Manifest Cache * * Implements TTL-based caching for registry manifests to reduce network requests. * Cache location: ~/.fractary/registry/cache/ */ import type { RegistryManifest } from './types.js'; /** * Cached manifest entry with metadata */ export interface ManifestCache { /** Original registry URL */ url: string; /** Cached manifest data */ manifest: RegistryManifest; /** Unix timestamp when fetched (milliseconds) */ fetched_at: number; /** Time-to-live in seconds */ ttl: number; } /** * Cache statistics for monitoring */ export interface CacheStats { /** Total number of cached entries */ total_entries: number; /** Number of fresh (valid) entries */ fresh_entries: number; /** Number of expired entries */ expired_entries: number; /** Total cache size in bytes */ total_size_bytes: number; /** Cache directory path */ cache_dir: string; } export declare class ManifestCacheManager { private cacheDir; constructor(cacheDir?: string); /** * Get cache file path for a registry */ private getCachePath; /** * Ensure cache directory exists */ private ensureCacheDir; /** * Get cached manifest if fresh * @returns Cached manifest if exists and fresh, null otherwise */ get(registryName: string): Promise; /** * Store manifest in cache */ set(registryName: string, url: string, manifest: RegistryManifest, ttl?: number): Promise; /** * Check if cached entry is fresh (not expired) */ isFresh(cache: ManifestCache): boolean; /** * Get age of cached entry in seconds */ getAge(cache: ManifestCache): number; /** * Invalidate (delete) cache for a registry */ invalidate(registryName: string): Promise; /** * Invalidate all cached manifests */ invalidateAll(): Promise; /** * List all cached registry names */ list(): Promise; /** * Get cache entry with metadata (for inspection) */ getEntry(registryName: string): Promise; /** * Get cache statistics */ getStats(): Promise; /** * Clean up expired cache entries * @returns Number of entries removed */ cleanup(): Promise; /** * Check if cache exists for a registry */ has(registryName: string): Promise; } /** * Default cache manager instance */ export declare const manifestCache: ManifestCacheManager; //# sourceMappingURL=cache.d.ts.map