UNPKG

@knath2000/codebase-indexing-mcp

Version:

MCP server for codebase indexing with Voyage AI embeddings and Qdrant vector storage

80 lines (79 loc) 1.97 kB
import { SearchResult, SearchQuery, Config } from '../types.js'; export declare class SearchCacheService { private cache; private ttl; private maxSize; private hitCount; private missCount; constructor(config: Config); /** * Get cached search results if available and not expired */ get(query: SearchQuery): SearchResult[] | null; /** * Store search results in cache */ set(query: SearchQuery, results: SearchResult[]): void; /** * Generate a unique cache key for a search query */ private generateCacheKey; /** * Evict the oldest cache entry (LRU) */ private evictOldest; /** * Clean up expired cache entries */ private cleanup; /** * Invalidate cache entries for a specific file (when file is modified) */ invalidateFile(filePath: string): void; /** * Invalidate cache entries for a specific language */ invalidateLanguage(language: string): void; /** * Clear all cache entries */ clear(): void; /** * Get current size of the cache (number of entries) */ size(): number; /** * Get estimated memory usage of the cache in bytes */ memoryUsage(): number; /** * Get cache statistics */ getStats(): { size: number; maxSize: number; hitCount: number; missCount: number; hitRate: number; ttl: number; memoryUsage: number; }; /** * Get cache entries for debugging */ getEntries(): Array<{ key: string; query: string; resultCount: number; age: number; metadata: any; }>; /** * Warm up the cache with common queries */ warmUp(commonQueries: string[]): Promise<void>; /** * Check if a query is likely to benefit from caching */ shouldCache(query: SearchQuery, results: SearchResult[]): boolean; }