Coin Brief ENDE

rippled #8660: key-only caches now report hits, misses and removals

Pull request #8660 by bthomee, merged into rippled on 17 November, changes how a key-only TaggedCache keeps its statistics. Until now its counters did not reflect what such a cache did: with the fix, touchIfExists() counts into hits_ and misses_, the values that getHitRate() reads; inserting a new key increments cacheCount_; and the key-only sweepHelper counts each erased entry as both a cache and a map removal, so that getCacheSize() follows getTrackSize() as it does for a cache that stores values.

The PR describes the change as "reporting only, with no behavior change in what the cache holds or returns". It removes the unread Stats members hits and misses and closes issue #7056. It is marked as a libxrpl change, one that may affect libxrpl or its dependents. Two new tests check a 50% hit rate after one hit and one miss, and a cache size that goes from two to one to zero over two sweeps, with a re-inserted key surviving the first sweep.

The same afternoon, #8487 merged a refactor that declares the JSON-RPC and ripplerpc version constants.

rippled #8660: key-only caches now report hits, misses and removals
rippled #8660: key-only caches now report hits, misses and removals — Coin Brief

Why it matters

A hit rate that never moves is worse than no hit rate, because it looks like data. The fix does not make the cache faster; it makes its numbers describe what it actually did, which is what an operator needs before tuning it.

Written by Victoria Shinder.