Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 686b7359cd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pub load_requests: u64, | ||
| pub memory_hits: u64, | ||
| pub disk_hits: u64, | ||
| pub network_fetches: u64, | ||
| pub in_flight_waits: u64, |
There was a problem hiding this comment.
Preserve CacheStats compatibility in 2.x releases
This commit removes the public CacheStats surface (hits, misses, and hit_ratio) and replaces it with new fields, which is a source-compatible break for existing 2.x consumers that currently compile against those members. Any downstream code reading stats.hits or calling stats.hit_ratio() will fail to build after updating. To avoid breaking users, keep deprecated compatibility accessors/fields for the 2.x line (or publish this as a major-version API break).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This API change is intentional. The old hits / misses / hit_ratio() surface was materially misleading, so we do not want to preserve it in the new metrics model. We are treating this as an acceptable breaking change for this release line rather than carrying forward compatibility accessors that keep the ambiguous semantics alive.
| async fn get_cached_network(cache_key: String) -> Option<NetworkRef> { | ||
| let cache_guard = cache().read().await; | ||
| if cache_guard.contains_key(&cache_key) { | ||
| record_hit(); | ||
| Some(NetworkRef::new(cache_guard, cache_key)) |
There was a problem hiding this comment.
Record memory hits for cache returns in load_or_insert
get_cached_network no longer increments any memory-hit metric, but load_or_insert uses this helper after the initial fast-path check. Under concurrent requests, a call can miss at load_or_fetch's first check, then return from memory here after another task inserts the network, and that successful memory-served request is never counted in memory_hits. This makes the new cache-outcome metrics systematically under-report memory hits during contention/races.
Useful? React with 👍 / 👎.
No description provided.