MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / hit_rate

Method hit_rate

nodedb/src/engine/sparse/doc_cache.rs:298–306  ·  view source on GitHub ↗

Cache hit rate (0.0–1.0). Returns 0.0 if no lookups yet.

(&self)

Source from the content-addressed store, hash-verified

296
297 /// Cache hit rate (0.0–1.0). Returns 0.0 if no lookups yet.
298 pub fn hit_rate(&self) -> f64 {
299 let hits = self.hits.get();
300 let total = hits + self.misses.get();
301 if total == 0 {
302 0.0
303 } else {
304 hits as f64 / total as f64
305 }
306 }
307
308 /// Total cached documents across all database shards.
309 pub fn len(&self) -> usize {

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected