| package server | |
| import ( | |
| "net/http" | |
| ) | |
| type cachingHandler struct { | |
| h http.Handler | |
| } | |
| func NewCachingHandler(h http.Handler) http.Handler { | |
| return cachingHandler{h} | |
| } | |
| func (h cachingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |
| w.Header().Set("Cache-Control", "max-age=604800") | |
| h.h.ServeHTTP(w, r) | |
| } |