Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMiddleware ¶
func NewMiddleware(next http.HandlerFunc, store store.Store, opts ...Options) http.HandlerFunc
Types ¶
type AllowBypassHeader ¶
type AllowBypassHeader struct{ Key, Value string }
AllowBypassHeader enable a client to set the `Cache-Status` header to `bypass` so he will not get cached data
func (AllowBypassHeader) ExtractBool ¶
func (opt AllowBypassHeader) ExtractBool(r *http.Request) bool
ExtractBool check if request can bypass depending on request
func (AllowBypassHeader) ExtractString ¶
func (opt AllowBypassHeader) ExtractString(r *http.Request) string
ExtractString does nothing but return empty string (function required to match the interface)
type AllowBypassMethod ¶
type AllowBypassMethod struct{ Key string }
AllowBypassMethod defined methods that automatically bypass the caching e.g. post or put
func (AllowBypassMethod) ExtractBool ¶
func (opt AllowBypassMethod) ExtractBool(r *http.Request) bool
ExtractBool check if request can bypass depending on request
func (AllowBypassMethod) ExtractString ¶
func (opt AllowBypassMethod) ExtractString(r *http.Request) string
ExtractString does nothing but return empty string (function required to match the interface)
type HttpRecorder ¶
type HttpRecorder struct { http.ResponseWriter Body *bytes.Buffer }
HttpRecorder is a custom response writer that records the body
func NewHttpRecorder ¶
func NewHttpRecorder(responseWriter http.ResponseWriter) *HttpRecorder
NewHttpRecorder create a new NewHttpRecorder with given ResponseWriter
func (*HttpRecorder) Write ¶
func (hr *HttpRecorder) Write(buf []byte) (int, error)
Write byte data is written to rw.Body, if not nil.
func (*HttpRecorder) WriteString ¶
func (hr *HttpRecorder) WriteString(str string) (int, error)
WriteString string data is written to rw.Body, if not nil.
type UseHeaderKey ¶
type UseHeaderKey struct{ Key string }
UseQueryParamsKey tells the cache to........
func (UseHeaderKey) ExtractBool ¶
func (opt UseHeaderKey) ExtractBool(r *http.Request) bool
ExtractBool does nothing but return false (function required to match the interface)
func (UseHeaderKey) ExtractString ¶
func (opt UseHeaderKey) ExtractString(r *http.Request) string
ExtractString key from request and return the string
type UseMethodKey ¶
type UseMethodKey struct{}
UseMethodKey tells the cache to use the http method as part of the key
func (UseMethodKey) ExtractBool ¶
func (opt UseMethodKey) ExtractBool(r *http.Request) bool
ExtractBool does nothing but return false (function required to match the interface)
func (UseMethodKey) ExtractString ¶
func (opt UseMethodKey) ExtractString(r *http.Request) string
ExtractString key from request and return the string
type UsePathKey ¶
type UsePathKey struct{}
UsePathKey tells the cache to use path as part of the key
func (UsePathKey) ExtractBool ¶
func (opt UsePathKey) ExtractBool(r *http.Request) bool
ExtractBool does nothing but return false (function required to match the interface)
func (UsePathKey) ExtractString ¶
func (opt UsePathKey) ExtractString(r *http.Request) string
ExtractString key from request and return the string
type UseQueryParamsKey ¶
type UseQueryParamsKey struct{ Key string }
UseQueryParamsKey tells the cache to use query parameter value for given key as part of the key
func (UseQueryParamsKey) ExtractBool ¶
func (opt UseQueryParamsKey) ExtractBool(r *http.Request) bool
ExtractBool does nothing but return false (function required to match the interface)
func (UseQueryParamsKey) ExtractString ¶
func (opt UseQueryParamsKey) ExtractString(r *http.Request) string
ExtractString key from request and return the string