Documentation ¶
Index ¶
Constants ¶
View Source
const ( XCacheHeader = "X-Mmbros-Cache" XCacheMiss = "MISS" XCacheExpired = "EXPIRED" XCacheHit = "HIT" )
Response Header name and values
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { http.Client // CacheFolder is the folder where the responses are saved in. // If the folder doesn't exist, it is created only when needed. CacheFolder string // MaxAge function returns the TTL duration for each url. MaxAge MaxAger // AddResponseHeader enabled the custom X-Mmbros-Cache header in the // response with values MISS, HIT, EXPIRED AddResponseHeader bool }
Client is an HTTP client that cached responses.
func NewTTL ¶
NewTTL creates a new httpcache.Client that caches all the responses for the same constant ttl duration.
func (*Client) Do ¶
Do sends an HTTP request and returns an HTTP response, following policy (such as redirects, cookies, auth) as configured on the client.
Click to show internal directories.
Click to hide internal directories.