ttl

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForbidsStoring added in v1.3.3

func ForbidsStoring(directives map[string]string) bool

ForbidsStoring - Reports whether the response directives forbid a shared cache from storing the response:

  • no-store (RFC 9111 §5.2.2.5);
  • private, qualified or not (§5.2.2.7): a qualified private="Field" would allow storing the response minus those fields, but a full-page cache doesn't strip headers, so it's treated as unqualified private;
  • no-cache (§5.2.2.4): the RFC allows storing it if always revalidated; this cache doesn't revalidate, so it's never stored (stricter, safe).

func GetTTL

func GetTTL(headers http.Header, defaultTTL int) time.Duration

GetTTL - Retrieves TTL is seconds from Expires and Cache-Control HTTP headers.

func GetTTLFromCacheControl

func GetTTLFromCacheControl(cacheType string, cacheControl string) time.Duration

GetTTLFromCacheControl - Retrieves TTL value from Cache-Control header.

func ParseCacheControl added in v1.3.3

func ParseCacheControl(headers http.Header) map[string]string

ParseCacheControl - Parses every Cache-Control header field into a map of lowercased directive name to its (unquoted) argument, per RFC 9111 §5.2. Multiple fields are combined as one comma-separated list (RFC 9110 §5.3). When a directive is repeated, the first occurrence wins.

Types

This section is empty.

Jump to

Keyboard shortcuts

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