Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HttpCache ¶
type HttpCache struct {
// contains filtered or unexported fields
}
A HttpCache is a caching middleware.
func NewDefault ¶
func NewDefault() *HttpCache
NewDefault creates a new instance of `http-cache` middleware with default Options.
func (*HttpCache) ServeHTTP ¶
func (c *HttpCache) ServeHTTP(rw http.ResponseWriter, req *http.Request, next http.HandlerFunc)
ServeHTTP is a Negroni middleware compatible interface.
type Options ¶
type Options struct { // AllowedVerbs is the list of HTTP Verbs that allowed for caching. // Supported cachable verbs: GET, HEAD, OPTIONS. // All supported verbs are allowed by http. AllowedVerbs []string // MaxAge is the maximum age in milliseconds response entry remains in cache. // Default value is 60000 milliseconds. MaxAge int64 // Size is the initial capacity of cache. // Default value is 1000. Size int }
Options a configuration container for `httpcache` middleware.
type ResponseRecorder ¶
type ResponseRecorder interface { http.ResponseWriter Body() *bytes.Buffer Code() int Result() *http.Response }
func NewResponseRecorder ¶
func NewResponseRecorder() ResponseRecorder
Click to show internal directories.
Click to hide internal directories.