cacheutils

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2015 License: GPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheSatisfiesRequest

func CacheSatisfiesRequest(obj *types.ObjectMetadata, req *http.Request) bool

CacheSatisfiesRequest returs whether the client allows the requested content to be retrieved from the cache and whether the cache we have is fresh enough to be used for handling the request.

func IsResponseCacheable

func IsResponseCacheable(code int, headers http.Header) bool

IsResponseCacheable returs whether the upstream server allows the requested content to be saved in the cache. True result and 0 duration means that the response has no expiry date.

func ResponseExpiresIn

func ResponseExpiresIn(headers http.Header, ifNotAny time.Duration) time.Duration

ResponseExpiresIn parses the expiration time from upstream headers, if any, and returns it as a duration from now. If no expire time is found, it returns its second argument: the default expiration time.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL