MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / NoCache

Function NoCache

pkg/webmiddleware/cache_headers.go:20–26  ·  view source on GitHub ↗

NoCache is a middleware function that adds headers that prevent proxies from caching responses.

(next http.Handler)

Source from the content-addressed store, hash-verified

18
19// NoCache is a middleware function that adds headers that prevent proxies from caching responses.
20func NoCache(next http.Handler) http.Handler {
21 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
22 w.Header().Set("Cache-Control", "no-store")
23 w.Header().Set("Pragma", "no-cache")
24 next.ServeHTTP(w, r)
25 })
26}

Callers 1

TestNoCacheFunction · 0.85

Calls 3

HeaderMethod · 0.80
SetMethod · 0.65
ServeHTTPMethod · 0.45

Tested by 1

TestNoCacheFunction · 0.68