/** * Cache Manager - Centralized cache operations with improved error handling */ import { RedisManager } from "./redis-manager.js"; export interface Memory { id: string; memory: string; metadata?: Record; created_at: string; updated_at?: string; user_id: string; source?: string; relevance_score?: number; score_breakdown?: { semantic: number; keyword: number; entity: number; relationship: number; recency: number; }; matched_entities?: string[]; matched_relationships?: string[]; } export interface CacheConfig { ttl: { l1: number; l2: number; search: number; }; maxSize: number; frequentAccessThreshold: number; } export declare class CacheKeys { static memory: (id: string) => string; static access: (id: string) => string; static keyword: (word: string) => string; static memoryKeywords: (id: string) => string; static search: (query: string, limit: number) => string; } export declare class CacheManager { private redisManager; private config; constructor(redisManager: RedisManager, config?: Partial); getCachedMemory(memoryId: string): Promise; setCachedMemory(memoryId: string, data: Memory, ttl?: number): Promise; deleteCachedMemory(memoryId: string): Promise; private trackAccess; private determineTTL; private getAccessCount; private indexMemoryForSearch; cacheSearchResults(query: string, limit: number, results: Memory[]): Promise; getCachedSearchResults(query: string, limit: number): Promise; invalidateSearchCache(): Promise; getTopMemories(limit?: number): Promise; searchFromCache(query: string, limit: number): Promise; optimizeCache(memories: Memory[], maxMemories: number, forceRefresh?: boolean): Promise<{ cached: number; l1Count: number; l2Count: number; }>; getCacheStats(): Promise<{ totalMemories: number; totalAccess: number; hitRate: string; memoryUsage: string; topAccessed: Array<{ key: string; count: string; }>; }>; batchGet(memoryIds: string[]): Promise<(Memory | null)[]>; batchSet(memories: Memory[], ttl?: number): Promise; batchDelete(memoryIds: string[]): Promise; } //# sourceMappingURL=cache-manager.d.ts.map