(
&self,
caches: &[(String, Arc<dyn ManagedCache + Send + Sync>)],
eviction_percentage: f32,
)
| 332 | } |
| 333 | |
| 334 | fn evict_from_caches( |
| 335 | &self, |
| 336 | caches: &[(String, Arc<dyn ManagedCache + Send + Sync>)], |
| 337 | eviction_percentage: f32, |
| 338 | ) -> usize { |
| 339 | let mut total_evicted = 0; |
| 340 | |
| 341 | for (name, cache) in caches { |
| 342 | let initial_size = cache.len(); |
| 343 | if initial_size == 0 { |
| 344 | continue; |
| 345 | } |
| 346 | |
| 347 | let evicted = cache.evict_percentage(eviction_percentage); |
| 348 | total_evicted += evicted; |
| 349 | |
| 350 | let final_size = cache.len(); |
| 351 | let actual_evicted = initial_size.saturating_sub(final_size); |
| 352 | |
| 353 | debug!("Cache '{}': evicted {} entries ({} -> {})", |
| 354 | name, actual_evicted, initial_size, final_size); |
| 355 | } |
| 356 | |
| 357 | total_evicted |
| 358 | } |
| 359 | |
| 360 | /// Get current statistics |
| 361 | pub fn get_stats(&self) -> MemoryAwareCacheStats { |
no test coverage detected