/** * Represents a cached Apple Developer documentation document */ export interface CachedDocument { /** Original documentation URL */ url: string; /** URL hash for cache key/resource URI */ hash: string; /** Formatted markdown content */ markdown: string; /** Document title */ title: string; /** Documentation type (api, guide, framework, etc.) */ type: string; /** Cache creation timestamp */ timestamp: Date; /** Usage tracking for LRU eviction */ accessCount: number; } /** * Cache statistics for monitoring and optimization */ export interface CacheStats { /** Total number of cached documents */ totalDocuments: number; /** Total access count across all documents */ totalAccessCount: number; /** Average access count per document */ averageAccessCount: number; /** Memory usage estimation in bytes */ estimatedMemoryUsage: number; } /** * In-memory cache for Apple Developer documentation markdown content * Uses URL-based hashing for consistent cache keys and resource URIs */ export declare class DocumentCache { private cache; /** * Generate a consistent cache key from a URL using SHA-256 hashing * @param url The documentation URL * @returns 64-character hexadecimal hash string */ generateCacheKey(url: string): string; /** * Store a document in the cache * @param url The documentation URL * @param document The cached document data */ set(url: string, document: CachedDocument): void; /** * Retrieve a document from the cache and increment access count * @param url The documentation URL * @returns The cached document or undefined if not found */ get(url: string): CachedDocument | undefined; /** * Check if a document exists in the cache * @param url The documentation URL * @returns True if the document is cached */ has(url: string): boolean; /** * Get a document by its hash (used for resource access) * @param hash The document hash * @returns The cached document or undefined if not found */ getByHash(hash: string): CachedDocument | undefined; /** * Remove a document from the cache * @param url The documentation URL * @returns True if the document was removed */ delete(url: string): boolean; /** * Remove a document from the cache by hash * @param hash The document hash * @returns True if the document was removed */ deleteByHash(hash: string): boolean; /** * Get all cached documents * @returns Array of all cached documents */ getAll(): CachedDocument[]; /** * Get all document hashes (useful for resource listing) * @returns Array of all document hashes */ getAllHashes(): string[]; /** * Get the current cache size * @returns Number of cached documents */ size(): number; /** * Clear all cached documents */ clear(): void; /** * Get cache statistics for monitoring * @returns Cache statistics object */ getStats(): CacheStats; /** * Get least recently used documents for eviction * @param count Number of documents to return * @returns Array of documents sorted by access count (ascending) */ getLeastRecentlyUsed(count: number): CachedDocument[]; /** * Evict least recently used documents to free memory * @param count Number of documents to evict * @returns Array of evicted document hashes */ evictLRU(count: number): string[]; } //# sourceMappingURL=document-cache.d.ts.map