A standard compatible(RFC 7234) HTTP Cache middleware for negroni.
package main
import (
"fmt"
"net/http"
"github.com/urfave/negroni"
cah "github.com/trumanw/negroni-cache"
)
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "Welcome to the home page!")
})
n := negroni.Classic()
n.Use(cah.NewMiddleware(cah.NewMemoryCache()))
n.UseHandler(mux)
n.Run(":3000")
}