diff --git a/proxy/stats.go b/proxy/stats.go index 12a37a3..0e25951 100644 --- a/proxy/stats.go +++ b/proxy/stats.go @@ -17,13 +17,12 @@ func NewStatsHandler(cache *cache.MemoryCache) *StatsHandler { } func (h *StatsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - entries, size := h.cache.Stats() - - stats := map[string]interface{}{ - "entries": entries, - "size": size, - } + stats := h.cache.GetStats() w.Header().Set("Content-Type", "application/json") - json.NewEncoder(w).Encode(stats) + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + + encoder := json.NewEncoder(w) + encoder.SetIndent("", " ") + encoder.Encode(stats) }