CacheControlDirective uses ConstantsTrait
Enumeration of `Cache-Control` header directives (RFC 9111).
Covers both response and request directives, plus the widely deployed
extensions immutable (RFC 8246) and stale-while-revalidate /
stale-if-error (RFC 5861).
Some directives take an argument (max-age=3600, s-maxage=60); the
constants hold only the directive name.
Example:
$value = CacheControlDirective::PUBLIC . ', ' . CacheControlDirective::MAX_AGE . '=3600' ;
$response->withHeader( HttpHeader::CACHE_CONTROL , $value ) ; // 'public, max-age=3600'
Tags
Table of Contents
Constants
- IMMUTABLE : string = 'immutable'
- `immutable` — Response body will not change while fresh (RFC 8246).
- MAX_AGE : string = 'max-age'
- `max-age` — Maximum freshness lifetime in seconds (RFC 9111 §5.2.2.1 / §5.2.1.1).
- MAX_STALE : string = 'max-stale'
- `max-stale` — Client accepts a stale response within the given seconds (RFC 9111 §5.2.1.2).
- MIN_FRESH : string = 'min-fresh'
- `min-fresh` — Client wants a response still fresh for the given seconds (RFC 9111 §5.2.1.3).
- MUST_REVALIDATE : string = 'must-revalidate'
- `must-revalidate` — Stale response must be revalidated (RFC 9111 §5.2.2.2).
- MUST_UNDERSTAND : string = 'must-understand'
- `must-understand` — Cache must understand the status code to store it (RFC 9111 §5.2.2.3).
- NO_CACHE : string = 'no-cache'
- `no-cache` — Stored response must be revalidated before reuse (RFC 9111 §5.2.2.4).
- NO_STORE : string = 'no-store'
- `no-store` — Response must not be stored by any cache (RFC 9111 §5.2.2.5).
- NO_TRANSFORM : string = 'no-transform'
- `no-transform` — Intermediaries must not transform the payload (RFC 9111 §5.2.2.6).
- ONLY_IF_CACHED : string = 'only-if-cached'
- `only-if-cached` — Client wants a stored response only, no upstream fetch (RFC 9111 §5.2.1.7).
- PRIVATE : string = 'private'
- `private` — Response is for a single user; shared caches must not store it (RFC 9111 §5.2.2.7).
- PROXY_REVALIDATE : string = 'proxy-revalidate'
- `proxy-revalidate` — Like `must-revalidate`, for shared caches only (RFC 9111 §5.2.2.8).
- PUBLIC : string = 'public'
- `public` — Response may be stored by any cache (RFC 9111 §5.2.2.9).
- S_MAXAGE : string = 's-maxage'
- `s-maxage` — Like `max-age`, overrides it for shared caches (RFC 9111 §5.2.2.10).
- STALE_IF_ERROR : string = 'stale-if-error'
- `stale-if-error` — Serve stale if revalidation fails (RFC 5861).
- STALE_WHILE_REVALIDATE : string = 'stale-while-revalidate'
- `stale-while-revalidate` — Serve stale while revalidating in background (RFC 5861).
Constants
IMMUTABLE
`immutable` — Response body will not change while fresh (RFC 8246).
public
string
IMMUTABLE
= 'immutable'
MAX_AGE
`max-age` — Maximum freshness lifetime in seconds (RFC 9111 §5.2.2.1 / §5.2.1.1).
public
string
MAX_AGE
= 'max-age'
MAX_STALE
`max-stale` — Client accepts a stale response within the given seconds (RFC 9111 §5.2.1.2).
public
string
MAX_STALE
= 'max-stale'
MIN_FRESH
`min-fresh` — Client wants a response still fresh for the given seconds (RFC 9111 §5.2.1.3).
public
string
MIN_FRESH
= 'min-fresh'
MUST_REVALIDATE
`must-revalidate` — Stale response must be revalidated (RFC 9111 §5.2.2.2).
public
string
MUST_REVALIDATE
= 'must-revalidate'
MUST_UNDERSTAND
`must-understand` — Cache must understand the status code to store it (RFC 9111 §5.2.2.3).
public
string
MUST_UNDERSTAND
= 'must-understand'
NO_CACHE
`no-cache` — Stored response must be revalidated before reuse (RFC 9111 §5.2.2.4).
public
string
NO_CACHE
= 'no-cache'
NO_STORE
`no-store` — Response must not be stored by any cache (RFC 9111 §5.2.2.5).
public
string
NO_STORE
= 'no-store'
NO_TRANSFORM
`no-transform` — Intermediaries must not transform the payload (RFC 9111 §5.2.2.6).
public
string
NO_TRANSFORM
= 'no-transform'
ONLY_IF_CACHED
`only-if-cached` — Client wants a stored response only, no upstream fetch (RFC 9111 §5.2.1.7).
public
string
ONLY_IF_CACHED
= 'only-if-cached'
PRIVATE
`private` — Response is for a single user; shared caches must not store it (RFC 9111 §5.2.2.7).
public
string
PRIVATE
= 'private'
PROXY_REVALIDATE
`proxy-revalidate` — Like `must-revalidate`, for shared caches only (RFC 9111 §5.2.2.8).
public
string
PROXY_REVALIDATE
= 'proxy-revalidate'
PUBLIC
`public` — Response may be stored by any cache (RFC 9111 §5.2.2.9).
public
string
PUBLIC
= 'public'
S_MAXAGE
`s-maxage` — Like `max-age`, overrides it for shared caches (RFC 9111 §5.2.2.10).
public
string
S_MAXAGE
= 's-maxage'
STALE_IF_ERROR
`stale-if-error` — Serve stale if revalidation fails (RFC 5861).
public
string
STALE_IF_ERROR
= 'stale-if-error'
STALE_WHILE_REVALIDATE
`stale-while-revalidate` — Serve stale while revalidating in background (RFC 5861).
public
string
STALE_WHILE_REVALIDATE
= 'stale-while-revalidate'