Versions in this module Expand all Collapse all v1 v1.16.2 Sep 23, 2026 Changes in this version + func NewStashingWriter(limit int, dest io.Writer) *stashingWriter + type Cache interface + Get func(key CacheKey) ([]byte, bool) + Set func(key CacheKey, value []byte, expiresAt time.Time) + type CacheHandler struct + func NewCacheHandler(cache Cache, maxBodySize int, next http.Handler) *CacheHandler + func (h *CacheHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) + type CacheKey struct + Host string + Method string + Path string + Query string + Vary string + type CacheableResponse struct + Body []byte + HTTPHeader http.Header + StatusCode int + VariantHeader http.Header + func CacheableResponseFromBuffer(b []byte) (CacheableResponse, error) + func NewCacheableResponse(w http.ResponseWriter, maxBodyLength int) *CacheableResponse + func (c *CacheableResponse) CacheStatus() (bool, time.Time) + func (c *CacheableResponse) Flush() + func (c *CacheableResponse) Header() http.Header + func (c *CacheableResponse) ToBuffer() ([]byte, error) + func (c *CacheableResponse) Write(p []byte) (int, error) + func (c *CacheableResponse) WriteCachedResponse(w http.ResponseWriter, r *http.Request) + func (c *CacheableResponse) WriteHeader(statusCode int) + type GetCurrentTime func() time.Time + type MemoryCache struct + func NewMemoryCache(capacity, maxItemSize int) *MemoryCache + func (c *MemoryCache) Get(key CacheKey) ([]byte, bool) + func (c *MemoryCache) Set(key CacheKey, value []byte, expiresAt time.Time) + type Variant struct + func NewVariant(r *http.Request) *Variant + func (v *Variant) ApplyHeaderNames(names []string) + func (v *Variant) CacheKey() CacheKey + func (v *Variant) HeaderNames() []string + func (v *Variant) Matches(responseHeader http.Header) bool + func (v *Variant) SetResponseHeader(header http.Header) + func (v *Variant) VariantHeader() http.Header