Skip to content

Commit e6570ec

Browse files
jensensclaude
andcommitted
docs: add ZMI Cache Status section to query cache spec
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 567ee2f commit e6570ec

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

docs/plans/2026-04-02-query-result-cache-design.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,34 @@ In `_run_search()`:
104104
On a typical page with 10-15 catalog queries, the second page load
105105
should be nearly free (~2ms for 10 cache hits + 1 `MAX(tid)` check).
106106

107+
## ZMI visibility
108+
109+
The existing "Slow Queries" tab gets a second section: **Cache Status**.
110+
111+
### Display
112+
113+
- **Hit/Miss ratio**: total hits, misses, hit-rate percentage
114+
- **Entries**: current / max configured
115+
- **Last TID**: current cached TID + number of invalidations since start
116+
- **TTR**: configured rounding granularity (seconds)
117+
- **Top cached queries**: the N most expensive cached entries
118+
(query keys, cost_ms, hit count)
119+
- **Clear Cache** button (with confirmation dialog)
120+
121+
### Data source
122+
123+
The `QueryCache` singleton exposes a `stats()` method returning a dict
124+
with all the above. The ZMI tab calls `manage_get_cache_stats()` on
125+
the catalog tool, which delegates to `QueryCache.stats()`.
126+
107127
## Implementation steps
108128

109-
1. Create `cache.py` with `QueryCache` class
129+
1. Create `cache.py` with `QueryCache` class (incl. `stats()` method)
110130
2. Add query normalization (sort keys, round datetimes)
111131
3. Integrate into `_run_search()` with TID check
112132
4. Add env var configuration
113-
5. Tests: cache hit/miss, TID invalidation, cost eviction, TTR rounding
114-
6. Changelog + docs
133+
5. Add `manage_get_cache_stats()` + `manage_clear_cache()` to catalog
134+
6. Extend `catalogSlowQueries.dtml` with Cache Status section
135+
7. Tests: cache hit/miss, TID invalidation, cost eviction, TTR rounding,
136+
stats accuracy
137+
8. Changelog + docs

0 commit comments

Comments
 (0)