MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / computeHitRate

Function computeHitRate

src/utils/cacheStats.ts:30–36  ·  view source on GitHub ↗
(u: CacheUsage | null)

Source from the content-addressed store, hash-verified

28 * Compute integer hit rate (0–100) or null if denominator is zero / input null.
29 */
30export function computeHitRate(u: CacheUsage | null): number | null {
31 if (!u) return null
32 const denom =
33 u.input_tokens + u.cache_creation_input_tokens + u.cache_read_input_tokens
34 if (denom === 0) return null
35 return Math.round((u.cache_read_input_tokens / denom) * 100)
36}
37
38/**
39 * Stable string that uniquely identifies a usage snapshot.

Callers 4

CachePillFunction · 0.85
onResponseFunction · 0.85
cacheStats.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected