(&self, stats: &CacheManagerStats)
| 658 | } |
| 659 | |
| 660 | fn generate_recommendations(&self, stats: &CacheManagerStats) -> Vec<String> { |
| 661 | let mut recommendations = Vec::new(); |
| 662 | |
| 663 | if stats.global.overall_hit_rate() < 0.3 { |
| 664 | recommendations.push("Hit rate is low (<30%). Consider increasing cache sizes or reviewing query patterns.".to_string()); |
| 665 | } |
| 666 | |
| 667 | if stats.efficiency.eviction_rate > 0.1 { |
| 668 | recommendations.push("High eviction rate (>10%). Consider increasing memory limits or adjusting TTL settings.".to_string()); |
| 669 | } |
| 670 | |
| 671 | if stats.efficiency.memory_utilization > 0.9 { |
| 672 | recommendations.push("Memory utilization is high (>90%). Consider increasing max memory or enabling compression.".to_string()); |
| 673 | } |
| 674 | |
| 675 | if stats.result_cache.l1_hit_rate() < 0.1 { |
| 676 | recommendations.push( |
| 677 | "L1 cache hit rate is very low. Consider adjusting L1 size or TTL settings." |
| 678 | .to_string(), |
| 679 | ); |
| 680 | } |
| 681 | |
| 682 | recommendations |
| 683 | } |
| 684 | } |
| 685 | |
| 686 | /// Comprehensive cache statistics |
no test coverage detected