Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyHeaders ¶ added in v10.1.0
CopyHeaders clones headers "src" to "dst" .
Types ¶
type Entry ¶
type Entry struct { // when `Reset` this value is reseting to time.Now(), // it's used to send the "Last-Modified" header, // some clients may need it. LastModified time.Time // 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) Body ¶
Body returns contents will be served by the cache handler.
func (*Response) Headers ¶ added in v10.1.0
Headers returns the total headers of the cached response.