更新 proxy/stats.go
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user