Documentation ¶
Overview ¶
Package httpcache provides a cache enabled http Transport.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByteCache ¶
type ByteCache interface { Store(key string, value []byte, timeout time.Duration) error Get(key string) ([]byte, error) }
ByteCache is a key-value cache store
type Config ¶
type Config interface { // Key is a function that generates the cache key for the given http.Request. An empty string will disable caching. Key(req *http.Request) string // MaxAge provides the max cache age for the given request/response pair. A zero value will disable caching for the // pair. The request is available via res.Request. MaxAge(res *http.Response) time.Duration }
Config provides cache key & timeout logic
func CacheByPath ¶
CacheByPath caches against the host + path (ignoring scheme, auth, query etc) for the specified duration.
func CacheByURL ¶
CacheByURL caches against the entire URL for the specified duration.
Click to show internal directories.
Click to hide internal directories.