Documentation ¶
Overview ¶
Package cacheheaders implements support HTTP headers related to caching.
Currently, the package handles Cache-Control, Age and ETag
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheControl ¶
CacheControl contains the configuration for the generated Cache-Control header
type Headers ¶
type Headers struct {
// contains filtered or unexported fields
}
Headers provides support for returning the cache related headers. To initialize a Headers, call New().
func New ¶
func New(cacheControl *CacheControl, configHash string) *Headers
newCacheHandler returns a new cacheHandler from a *cacheConfig representing the cache configuration for an operation and the API configuration hash (typically from Api.ApiConfigHash)
func (*Headers) CacheControl ¶
CacheControl returns the value of the configured Cache-Control header
func (*Headers) NotModified ¶
NotModified checks the request and response headers and if they indicate the the client already has the resource, sends an http.StatusNotModified and returns true. If the headers don't match, nothing is done and false is returned.