rfc

package
v1.6.37 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 11 Imported by: 11

Documentation

Index

Constants

View Source
const StoredTTLHeader = "X-Souin-Stored-TTL"

Variables

This section is empty.

Functions

func GetCacheKeyFromCtx

func GetCacheKeyFromCtx(currentCtx ctx.Context) string

func GetVariedCacheKey

func GetVariedCacheKey(rq *http.Request, headers []string) string

GetVariedCacheKey returns the varied cache key for req and resp.

func HeaderAllCommaSepValues

func HeaderAllCommaSepValues(headers http.Header) []string

headerAllCommaSepValues returns all comma-separated values (each with whitespace trimmed) for header name in headers. 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

func HitStaleCache(h *http.Header)

HitStaleCache set hit and stale in the Cache-Status header

func SetCacheStatusHeader

func SetCacheStatusHeader(resp *http.Response) *http.Response

SetCacheStatusHeader set the Cache-Status header

func SetRequestCacheStatus

func SetRequestCacheStatus(h *http.Header, header, cacheName string)

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

This section is empty.

Jump to

Keyboard shortcuts

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