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

Method remove

src/cache/ttl_cache.rs:268–284  ·  view source on GitHub ↗

Remove a specific key from the cache

(&self, key: &K)

Source from the content-addressed store, hash-verified

266
267 /// Remove a specific key from the cache
268 pub fn remove(&self, key: &K) -> Option<V> {
269 let mut entries = self.entries.write();
270 let mut stats = self.stats.write();
271
272 if let Some(entry) = entries.remove(key) {
273 stats.total_entries = entries.len();
274 stats.total_size_bytes = stats.total_size_bytes.saturating_sub(entry.size_bytes);
275 stats.evictions += 1;
276
277 // Unregister memory usage
278 global_memory_monitor().record_query_deallocation(entry.size_bytes as u64);
279
280 Some(entry.value)
281 } else {
282 None
283 }
284 }
285
286 /// Clear all entries from the cache
287 pub fn clear(&self) {

Callers 15

invalidate_typeMethod · 0.45
evict_oldestMethod · 0.45
getMethod · 0.45
insertMethod · 0.45
invalidateMethod · 0.45
getMethod · 0.45
evict_least_valuableMethod · 0.45
getMethod · 0.45
insertMethod · 0.45
invalidateMethod · 0.45
get_schemaMethod · 0.45
getMethod · 0.45

Calls 3

global_memory_monitorFunction · 0.85
lenMethod · 0.45

Tested by 1

test_sqlite_onlyFunction · 0.36