Versions in this module Expand all Collapse all v1 v1.0.0 Sep 25, 2024 Changes in this version + func MonitorFunc(interval time.Duration, logFunc func(Stats)) *monitorFunc + func New(o Config) *microcache + type Compressor interface + Compress func(Response) Response + Expand func(Response) Response + type CompressorGzip struct + func (c CompressorGzip) Compress(res Response) Response + func (c CompressorGzip) Expand(res Response) Response + type CompressorSnappy struct + func (c CompressorSnappy) Compress(res Response) Response + func (c CompressorSnappy) Expand(res Response) Response + type Config struct + CollapsedForwarding bool + Compressor Compressor + Driver Driver + Exposed bool + HashQuery bool + Monitor Monitor + Nocache bool + QueryIgnore []string + StaleIfError time.Duration + StaleRecache bool + StaleWhileRevalidate time.Duration + SuppressAgeHeader bool + TTL time.Duration + Timeout time.Duration + Vary []string + type Driver interface + Get func(string) (Response, bool) + GetRequestOpts func(string) (RequestOpts, bool) + GetSize func() int + Remove func(string) error + Set func(string, Response) error + SetRequestOpts func(string, RequestOpts) error + type DriverARC struct + RequestCache *lru.ARCCache + ResponseCache *lru.ARCCache + func NewDriverARC(size int) DriverARC + func (c DriverARC) Get(hash string) (res Response, collision bool) + func (c DriverARC) GetRequestOpts(hash string) (req RequestOpts, collision bool) + func (c DriverARC) GetSize() int + func (c DriverARC) Remove(hash string) error + func (c DriverARC) Set(hash string, res Response) error + func (c DriverARC) SetRequestOpts(hash string, req RequestOpts) error + type DriverLRU struct + RequestCache *lru.Cache + ResponseCache *lru.Cache + func NewDriverLRU(size int) DriverLRU + func (c DriverLRU) Get(hash string) (res Response, collision bool) + func (c DriverLRU) GetRequestOpts(hash string) (req RequestOpts, collision bool) + func (c DriverLRU) GetSize() int + func (c DriverLRU) Remove(hash string) error + func (c DriverLRU) Set(hash string, res Response) error + func (c DriverLRU) SetRequestOpts(hash string, req RequestOpts) error + type DriverRistretto struct + Cache *ristretto.Cache[string, any] + func NewDriverRistretto(requests, size int64) DriverRistretto + func (d DriverRistretto) Get(hash string) (res Response, collision bool) + func (d DriverRistretto) GetRequestOpts(hash string) (req RequestOpts, collision bool) + func (d DriverRistretto) GetSize() int + func (d DriverRistretto) Remove(hash string) error + func (d DriverRistretto) Set(hash string, res Response) error + func (d DriverRistretto) SetRequestOpts(hash string, req RequestOpts) error + type Microcache interface + Middleware func(http.Handler) http.Handler + Start func() + Stop func() + type Monitor interface + Backend func() + Collision func() + Error func() + GetInterval func() time.Duration + Hit func() + Log func(Stats) + Miss func() + Stale func() + type RequestOpts struct + type Response struct + func (res *Response) Header() http.Header + func (res *Response) Write(b []byte) (int, error) + func (res *Response) WriteHeader(code int) + type Stats struct + Backend int + Collisions int + Errors int + Hits int + Misses int + Size int + Stales int