Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { // Directory where the cache is stored. Defaults to httpdisk. Dir string // If true, don't include the request hostname in the path for each element. NoHosts bool }
Cache will cache http.Responses on disk, using the http.Request to calculate a key. It deals with keys and files, not the network.
func (*Cache) Canonical ¶
Canonical calculates a signature for the request based on the http method, the normalized URL, and the request body if present. The signature can be quite long since it contains the request body.
func (*Cache) Get ¶
Get the cached data for a request. An empty byte array will be returned if the entry doesn't exist or can't be read for any reason.
type HTTPDisk ¶
type HTTPDisk struct { // Underlying Cache. Cache Cache // if nil, http.DefaultTransport is used. Transport http.RoundTripper }
HTTPDisk is a caching http transport.
func NewHTTPDisk ¶
NewHTTPDisk constructs a new HTTPDisk.
Click to show internal directories.
Click to hide internal directories.