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

Function hit_rate_tracking

nodedb/src/engine/sparse/doc_cache.rs:417–425  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

415
416 #[test]
417 fn hit_rate_tracking() {
418 let mut cache = DocCache::new(16);
419 cache.put(0, 1, "c", "a", b"1");
420 cache.get(0, 1, "c", "a"); // hit
421 cache.get(0, 1, "c", "a"); // hit
422 cache.get(0, 1, "c", "b"); // miss
423 assert!((cache.hit_rate() - 0.6667).abs() < 0.01);
424 assert_eq!(cache.total_lookups(), 3);
425 }
426
427 // ── Per-database isolation ─────────────────────────────────────────────
428

Callers

nothing calls this directly

Calls 2

putMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected