Documentation
¶
Index ¶
Constants ¶
View Source
const HTTPCacheHeader = "X-Http-Cache"
Variables ¶
This section is empty.
Functions ¶
func DefaultRequestChecker ¶
func IsCachedResponse ¶
Types ¶
type Option ¶
type Option func(*Transport)
func WithCacheKeyFn ¶
WithCacheKeyFn returns a new RoundTripper that will use a custom function to generate cache keys
func WithRequestChecker ¶
WithRequestChecker returns a new RoundTripper that will check if a request should be cached
type RedisCache ¶
func (*RedisCache) Set ¶
func (c *RedisCache) Set(key string, data []byte)
type Transport ¶
type Transport struct {
// The RoundTripper interface actually used to make requests
// If nil, http.DefaultTransport is used
Cache *cache.Cache
// contains filtered or unexported fields
}
Transport is an implementation of http.RoundTripper that will return values from a cache where possible (avoiding a network request) and will additionally add validators (etag/if-modified-since) to repeated requests allowing servers to return 304 / Not Modified
func NewCacheTransport ¶
Click to show internal directories.
Click to hide internal directories.