Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CacheMiddleware ¶
type CacheMiddleware struct {
// contains filtered or unexported fields
}
func New ¶
func New(cache Cache, opts ...Option) *CacheMiddleware
func (*CacheMiddleware) RoundTripper ¶
func (m *CacheMiddleware) RoundTripper(next http.RoundTripper) http.RoundTripper
type CacheWithTTL ¶
type KeyGenerator ¶
KeyGenerator is an interface that defines a method for generating a cache key based on an HTTP request. If a Cache implementation also implements this interface, the CacheMiddleware will use the Key method to generate cache keys.
type Option ¶
type Option func(*CacheMiddleware)
func WithCacheableReq ¶
WithCacheableReq is an option function that sets a custom function to determine if a request is cacheable. The provided function `f` takes an *http.Request and returns a boolean indicating whether the request should be cached.
Click to show internal directories.
Click to hide internal directories.