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

Method clear

src/cache/ttl_cache.rs:287–303  ·  view source on GitHub ↗

Clear all entries from the cache

(&self)

Source from the content-addressed store, hash-verified

285
286 /// Clear all entries from the cache
287 pub fn clear(&self) {
288 let mut entries = self.entries.write();
289 let mut stats = self.stats.write();
290
291 let total_size = stats.total_size_bytes;
292 let entries_count = entries.len();
293
294 entries.clear();
295 stats.total_entries = 0;
296 stats.total_size_bytes = 0;
297 stats.evictions += entries_count as u64;
298
299 // Unregister memory usage
300 if total_size > 0 {
301 global_memory_monitor().record_query_deallocation(total_size as u64);
302 }
303 }
304
305 /// Get current cache statistics
306 pub fn stats(&self) -> CacheStats {

Callers 1

test_cache_clearFunction · 0.45

Calls 3

global_memory_monitorFunction · 0.85
lenMethod · 0.45

Tested by 1

test_cache_clearFunction · 0.36