Documentation
¶
Index ¶
- func ApplyNegativeTTL(status int, negativeTTL map[int]int, defaultTTL time.Duration) time.Duration
- func PurgeCachedContent(ctx context.Context, upstream config.Upstream, rc RequestCallDTO) (bool, error)
- func RetrieveCachedContent(ctx context.Context, rc RequestCallDTO, logger *log.Entry) (cache.URIObj, error)
- func StorageTTL(uri cache.URIObj, domainConfigCache config.Cache) time.Duration
- func StoreGeneratedPage(ctx context.Context, rc RequestCallDTO, domainConfigCache config.Cache) (bool, error)
- type RequestCallDTO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyNegativeTTL ¶ added in v1.3.1
ApplyNegativeTTL - Overrides the TTL for a configured status (e.g. 404/502) with its own short TTL instead of inheriting origin cache headers, which error pages rarely set sanely. This shields the origin from repeated hits on a broken URL.
func PurgeCachedContent ¶
func PurgeCachedContent(ctx context.Context, upstream config.Upstream, rc RequestCallDTO) (bool, error)
PurgeCachedContent - Purges a content in the cache, or everything cached for the host when the request-target is cache.PurgeAllPath.
func RetrieveCachedContent ¶
func RetrieveCachedContent(ctx context.Context, rc RequestCallDTO, logger *log.Entry) (cache.URIObj, error)
RetrieveCachedContent - Retrives the cached response.
func StorageTTL ¶ added in v1.4.0
StorageTTL - Decides the TTL a response is stored with, by precedence:
- negative_ttl, for the statuses it lists;
- override_ttl, when > 0, replacing any origin freshness information;
- s-maxage / max-age / Expires from the origin (see ttl.GetTTL);
- ttl, the default when the origin sends no freshness information.
It never makes a response storable: StoreFullPage still refuses what a shared cache must not store (no-store, private, no-cache, Authorization without public/s-maxage/must-revalidate) whatever TTL is returned here.
func StoreGeneratedPage ¶
func StoreGeneratedPage(ctx context.Context, rc RequestCallDTO, domainConfigCache config.Cache) (bool, error)
StoreGeneratedPage - Stores a response in the cache.
Types ¶
type RequestCallDTO ¶
type RequestCallDTO struct {
ReqID string
Response response.LoggedResponseWriter
Request http.Request
CacheObject cache.Object
}
RequestCallDTO - DTO object containing request and response.