@@ -104,11 +104,34 @@ In `_run_search()`:
104104On a typical page with 10-15 catalog queries, the second page load
105105should 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)
1101302 . Add query normalization (sort keys, round datetimes)
1111313 . Integrate into ` _run_search() ` with TID check
1121324 . 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