From 8305c2f2fe78732a14e4be1e8ad3a33d3f7f7a34 Mon Sep 17 00:00:00 2001 From: XOF Date: Mon, 15 Dec 2025 02:44:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20proxy/stats.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy/stats.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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) }