MCPcopy Create free account
hub / github.com/allegro/bigcache / getCacheStatsHandler

Function getCacheStatsHandler

server/stats_handler.go:22–33  ·  view source on GitHub ↗

returns the cache's statistics.

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

20
21// returns the cache's statistics.
22func getCacheStatsHandler(w http.ResponseWriter, r *http.Request) {
23 target, err := json.Marshal(cache.Stats())
24 if err != nil {
25 w.WriteHeader(http.StatusInternalServerError)
26 log.Printf("cannot marshal cache stats. error: %s", err)
27 return
28 }
29 // since we're sending a struct, make it easy for consumers to interface.
30 w.Header().Set("Content-Type", "application/json; charset=utf-8")
31 w.Write(target)
32 return
33}

Callers 2

TestGetStatsFunction · 0.85
statsIndexHandlerFunction · 0.85

Calls 3

StatsMethod · 0.80
SetMethod · 0.80
PrintfMethod · 0.65

Tested by 1

TestGetStatsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…