/** * Performance metrics for a cache operation */ export interface PerformanceMetric { id: string; operation: 'get' | 'set' | 'search' | 'warm'; timestamp: Date; duration: number; cacheHit: boolean; backend: string; querySize?: number; resultSize?: number; errorRate?: number; } /** * Performance benchmark result */ export interface BenchmarkResult { operation: string; avgDuration: number; minDuration: number; maxDuration: number; p95Duration: number; throughput: number; errorRate: number; sampleSize: number; } /** * Cache warming strategy configuration */ export interface WarmingStrategy { strategy: 'popular' | 'recent' | 'scheduled' | 'predictive'; batchSize: number; intervalMs?: number; popularityThreshold?: number; maxEntries?: number; } /** * Performance optimization recommendation */ export interface OptimizationRecommendation { type: 'cache_warming' | 'slow_query_optimization' | 'backend_tuning' | 'memory_optimization'; priority: 'high' | 'medium' | 'low'; description: string; impact: string; implementation: string; estimatedImprovement: number; } /** * Slow query detection result */ export interface SlowQuery { query: string; avgDuration: number; hitRate: number; frequency: number; lastSeen: Date; recommendation?: string; } /** * Cache warming progress */ export interface WarmingProgress { strategy: string; totalEntries: number; warmedEntries: number; progress: number; estimatedTimeRemaining: number; status: 'running' | 'paused' | 'completed' | 'error'; } /** * Optimizes cache performance through monitoring, warming, and recommendations */ export declare class PerformanceOptimizer { private metrics; private warmingStrategies; private warmingProgress; private isWarming; constructor(); /** * Record a performance metric */ recordMetric(metric: Omit): PerformanceMetric; /** * Get performance benchmarks for different operations */ getBenchmarks(periodHours?: number): BenchmarkResult[]; /** * Detect slow queries that could benefit from optimization */ detectSlowQueries(thresholdMs?: number): SlowQuery[]; /** * Generate optimization recommendations based on performance data */ getOptimizationRecommendations(): OptimizationRecommendation[]; /** * Start cache warming with specified strategy */ startCacheWarming(strategy: WarmingStrategy, cacheInterface?: any): Promise; /** * Execute cache warming strategy */ private executeWarmingStrategy; /** * Warm cache with popular queries */ private warmPopularQueries; /** * Warm cache with recent queries */ private warmRecentQueries; /** * Warm cache with scheduled queries */ private warmScheduledQueries; /** * Warm cache with predictive queries */ private warmPredictiveQueries; /** * Generate recommendation for slow query */ private generateSlowQueryRecommendation; /** * Get current warming progress */ getWarmingProgress(): WarmingProgress[]; /** * Get recent performance metrics */ getRecentMetrics(limit?: number): PerformanceMetric[]; /** * Clear all metrics (for testing) */ clear(): void; } export declare const globalPerformanceOptimizer: PerformanceOptimizer; //# sourceMappingURL=performance-optimizer.d.ts.map