ttl

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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