MCPcopy Create free account
hub / github.com/erans/pgsqlite / evict_from_caches

Method evict_from_caches

src/cache/memory_aware_manager.rs:334–358  ·  view source on GitHub ↗
(
        &self,
        caches: &[(String, Arc<dyn ManagedCache + Send + Sync>)],
        eviction_percentage: f32,
    )

Source from the content-addressed store, hash-verified

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 {

Callers 3

force_evictionMethod · 0.80

Calls 2

evict_percentageMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected