Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CacheEntry ¶ added in v1.0.1
func (*CacheEntry) Decode ¶ added in v1.0.1
func (c *CacheEntry) Decode(b []byte) error
func (*CacheEntry) Encode ¶ added in v1.0.1
func (c *CacheEntry) Encode() ([]byte, error)
func (*CacheEntry) Replay ¶ added in v1.0.1
func (c *CacheEntry) Replay(w http.ResponseWriter) error
type CacheMiddleware ¶
type CacheMiddleware struct {
// contains filtered or unexported fields
}
func (*CacheMiddleware) Handler ¶
func (m *CacheMiddleware) Handler(next echo.HandlerFunc) echo.HandlerFunc
type Config ¶
type Config struct { // TTL time to life of the cache. TTL time.Duration `default:"1m"` // Methods methods to be cached. Methods []string `default:"[GET]"` // StatusCode method to be cached. StatusCode []int `default:"[200,404]"` // IgnoreQuery if true the Query values from the requests are ignored on // the key generation. IgnoreQuery bool // Refresh fuction called before use the cache, if true, the cache is deleted. Refresh func(r *http.Request) bool // Cache fuction called before cache a request, if false, the request is not // cached. If set Method is ignored. Cache func(r *http.Request) bool }
Config defiens the configuration for a cache middleware.
type ResponseRecorder ¶
type ResponseRecorder struct { http.ResponseWriter // contains filtered or unexported fields }
func NewResponseRecorder ¶
func NewResponseRecorder(w http.ResponseWriter) *ResponseRecorder
func (*ResponseRecorder) Result ¶
func (r *ResponseRecorder) Result() *CacheEntry
func (*ResponseRecorder) WriteHeader ¶
func (w *ResponseRecorder) WriteHeader(statusCode int)
Click to show internal directories.
Click to hide internal directories.