Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseMaxAge ¶
ParseMaxAge parses the max age from the receiver parameter, "cache-control" header returns seconds as int64 if header not found or parse failed then it returns -1
Types ¶
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
Entry is the cache entry contains the expiration datetime and the response
func NewEntry ¶
NewEntry returns a new cache entry it doesn't sets the expiresAt & the response because these are setting each time on Reset
func (*Entry) ChangeLifetime ¶
func (e *Entry) ChangeLifetime(fdur LifeChanger)
ChangeLifetime modifies the life field which is the life duration of the cached response of this cache entry
useful when we find a max-age header from the handler
type LifeChanger ¶
LifeChanger is the function which returns a duration which will be compared with the current entry's (cache life) duration and execute the LifeChanger func to set the new life time
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response is the cached response will be send to the clients its fields setted at runtime on each of the non-cached executions non-cached executions = first execution, and each time after cache expiration datetime passed
func (*Response) ContentType ¶
ContentType returns a valid content type
func (*Response) StatusCode ¶
StatusCode returns a valid status code