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

Method record_cache_hit

src/cache/enhanced_statement_pool.rs:365–375  ·  view source on GitHub ↗

Record a cache hit and update access statistics

(&self, cache_key: &str)

Source from the content-addressed store, hash-verified

363
364 /// Record a cache hit and update access statistics
365 fn record_cache_hit(&self, cache_key: &str) {
366 let mut statements = self.statements.write().unwrap();
367 if let Some(entry) = statements.get_mut(cache_key) {
368 entry.access_count += 1;
369 entry.last_used = Instant::now();
370 }
371
372 let mut stats = self.stats.write().unwrap();
373 stats.cache_hits += 1;
374 stats.average_hit_rate = stats.cache_hits as f64 / stats.total_queries as f64;
375 }
376
377 /// Evict the least valuable entry from the cache
378 fn evict_least_valuable(&self, statements: &mut HashMap<String, CachedStatementEntry>) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected