func (e *Entry) Reset(statusCode int, contentType string,
	body []byte, lifeChanger LifeChanger) {
	if e.response == nil {
		e.response = &Response{}
	}
	if statusCode > 0 {
		e.response.statusCode = statusCode
	}
	if contentType != "" {
		e.response.contentType = contentType
	}
	e.response.body = body
	if lifeChanger != nil {
		e.ChangeLifetime(lifeChanger)
	}
	e.expiresAt = time.Now().Add(e.life)
}
Reset called each time the entry is expired
and the handler calls this after the original handler executed
to re-set the response with the new handler's content result
package entry
import (
	"time"
	"github.com/geekypanda/httpcache/cfg"
)
type Entry struct {
	life time.Duration
	expiresAt time.Time
	response *Response
}
func NewEntry(duration time.Duration) *Entry {
	if duration >= 0 && duration < cfg.MinimumCacheDuration {
		duration = cfg.MinimumCacheDuration
	}
	return &Entry{
		life:     duration,
		response: &Response{},
	}
}
func (e *Entry) Response() (*Response, bool) {
	if !e.valid() {
		return nil, false
	}
	return e.response, true
}
func (e *Entry) valid() bool {
	return !time.Now().After(e.expiresAt)
}
type LifeChanger func() time.Duration
func (e *Entry) ChangeLifetime(fdur LifeChanger) {
	if e.life < cfg.MinimumCacheDuration {
		newLifetime := fdur()
		if newLifetime > e.life {
			e.life = newLifetime
		} else {
			e.life = cfg.MinimumCacheDuration
		}
	}
}