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

Method evict_oldest

src/cache/statement_pool.rs:216–224  ·  view source on GitHub ↗

Evict the oldest entry from the cache

(&self, statements: &mut HashMap<String, CachedStatement>)

Source from the content-addressed store, hash-verified

214
215 /// Evict the oldest entry from the cache
216 fn evict_oldest(&self, statements: &mut HashMap<String, CachedStatement>) {
217 if let Some((oldest_key, _)) = statements
218 .iter()
219 .min_by_key(|(_, cached)| cached.last_used)
220 .map(|(k, v)| (k.clone(), v.last_used))
221 {
222 statements.remove(&oldest_key);
223 }
224 }
225
226 /// Update the last used time for a cached statement
227 pub fn touch(&self, query: &str) {

Callers 1

cache_metadataMethod · 0.80

Calls 2

cloneMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected