Documentation ¶
Index ¶
- Constants
- func GetCacheKeyFromCtx(currentCtx ctx.Context) string
- func GetVariedCacheKey(rq *http.Request, headers []string) string
- func HeaderAllCommaSepValues(headers http.Header, headerName string) []string
- func HeaderAllCommaSepValuesString(headers http.Header, headerName string) string
- func HitStaleCache(h *http.Header)
- func ParseRequest(req *http.Request) *core.Revalidator
- func SetCacheStatusHeader(resp *http.Response, storerName string) *http.Response
- func SetRequestCacheStatus(h *http.Header, header, cacheName string)
- func ValidateCacheControl(r *http.Response, requestCc *cacheobject.RequestCacheDirectives) bool
- func ValidateMaxAgeCachedResponse(co *cacheobject.RequestCacheDirectives, res *http.Response) *http.Response
- func ValidateMaxAgeCachedStaleResponse(co *cacheobject.RequestCacheDirectives, res *http.Response, addTime int) *http.Response
- func VariedHeaderAllCommaSepValues(headers http.Header) ([]string, bool)
- type Revalidator
Constants ¶
View Source
const ( StoredTTLHeader = "X-Souin-Stored-TTL" StoredLengthHeader = "X-Souin-Stored-Length" )
View Source
const ( VarySeparator = "{-VARY-}" DecodedHeaderSeparator = ";" )
Variables ¶
This section is empty.
Functions ¶
func GetCacheKeyFromCtx ¶
func GetVariedCacheKey ¶
GetVariedCacheKey returns the varied cache key for req and resp.
func HeaderAllCommaSepValues ¶
HeaderAllCommaSepValues returns all comma-separated values (each with whitespace trimmed) for a given header name. According to Section 4.2 of the HTTP/1.1 spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2), values from multiple occurrences of a header should be concatenated, if the header's value is a comma-separated list.
func HitStaleCache ¶
HitStaleCache set hit and stale in the Cache-Status header
func ParseRequest ¶
func ParseRequest(req *http.Request) *core.Revalidator
func SetCacheStatusHeader ¶
SetCacheStatusHeader set the Cache-Status header
func SetRequestCacheStatus ¶
SetRequestCacheStatus set the Cache-Status fwd=request
func ValidateCacheControl ¶
func ValidateCacheControl(r *http.Response, requestCc *cacheobject.RequestCacheDirectives) bool
ValidateCacheControl check the Cache-Control header
func ValidateMaxAgeCachedResponse ¶
func ValidateMaxAgeCachedResponse(co *cacheobject.RequestCacheDirectives, res *http.Response) *http.Response
func ValidateMaxAgeCachedStaleResponse ¶
func ValidateMaxAgeCachedStaleResponse(co *cacheobject.RequestCacheDirectives, res *http.Response, addTime int) *http.Response
Types ¶
type Revalidator ¶
type Revalidator struct { Matched bool IfNoneMatchPresent bool IfMatchPresent bool IfModifiedSincePresent bool IfUnmodifiedSincePresent bool IfUnmotModifiedSincePresent bool NeedRevalidation bool NotModified bool IfModifiedSince time.Time IfUnmodifiedSince time.Time IfNoneMatch []string IfMatch []string RequestETags []string ResponseETag string }
Click to show internal directories.
Click to hide internal directories.