ResponseCacheStrategy
in package
implements
ResponseCacheStrategyInterface
ResponseCacheStrategy knows how to compute the Response cache HTTP header based on the different response cache headers.
This implementation changes the master response TTL to the smallest TTL received or force validation if one of the surrogates has validation cache strategy.
Tags
Interfaces, Classes, Traits and Enums
- ResponseCacheStrategyInterface
- ResponseCacheStrategyInterface implementations know how to compute the Response cache HTTP header based on the different response cache headers.
Table of Contents
- $age : mixed
- $ageDirectives : mixed
- $embeddedResponses : mixed
- $flagDirectives : mixed
- $inheritDirectives : mixed
- Cache-Control headers that are sent to the final response if they appear in ALL of the responses.
- $isNotCacheableResponseEmbedded : mixed
- $overrideDirectives : mixed
- Cache-Control headers that are sent to the final response if they appear in ANY of the responses.
- add() : mixed
- Adds a Response.
- update() : mixed
- Updates the Response HTTP headers based on the embedded Responses.
- storeRelativeAgeDirective() : mixed
- Store lowest max-age/s-maxage/expires for the final response.
- willMakeFinalResponseUncacheable() : bool
- RFC2616, Section 13.4.
Properties
$age
private
mixed
$age
= 0
$ageDirectives
private
mixed
$ageDirectives
= ['max-age' => null, 's-maxage' => null, 'expires' => null]
$embeddedResponses
private
mixed
$embeddedResponses
= 0
$flagDirectives
private
mixed
$flagDirectives
= ['no-cache' => null, 'no-store' => null, 'no-transform' => null, 'must-revalidate' => null, 'proxy-revalidate' => null, 'public' => null, 'private' => null, 'immutable' => null]
$inheritDirectives
Cache-Control headers that are sent to the final response if they appear in ALL of the responses.
private
static mixed
$inheritDirectives
= ['public', 'immutable']
$isNotCacheableResponseEmbedded
private
mixed
$isNotCacheableResponseEmbedded
= false
$overrideDirectives
Cache-Control headers that are sent to the final response if they appear in ANY of the responses.
private
static mixed
$overrideDirectives
= ['private', 'no-cache', 'no-store', 'no-transform', 'must-revalidate', 'proxy-revalidate']
Methods
add()
Adds a Response.
public
add(Response $response) : mixed
Parameters
- $response : Response
Return values
mixed —update()
Updates the Response HTTP headers based on the embedded Responses.
public
update(Response $response) : mixed
Parameters
- $response : Response
Return values
mixed —storeRelativeAgeDirective()
Store lowest max-age/s-maxage/expires for the final response.
private
storeRelativeAgeDirective(string $directive, int|null $value, int $age) : mixed
The response might have been stored in cache a while ago. To keep things comparable, we have to subtract the age so that the value is normalized for an age of 0.
If the value is lower than the currently stored value, we update the value, to keep a rolling minimal value of each instruction. If the value is NULL, the directive will not be set on the final response.
Parameters
- $directive : string
- $value : int|null
- $age : int
Return values
mixed —willMakeFinalResponseUncacheable()
RFC2616, Section 13.4.
private
willMakeFinalResponseUncacheable(Response $response) : bool
Parameters
- $response : Response