Cache
extends ConfigurationAnnotation
in package
The Cache class handles the Cache annotation parts.
Tags
Table of Contents
- $etag : string
- An expression to compute the ETag HTTP header.
- $expires : string
- The expiration date as a valid date for the strtotime() function.
- $lastModified : string
- An expression to compute the Last-Modified HTTP header.
- $maxage : int
- The number of seconds that the response is considered fresh by a private cache like a web browser.
- $maxStale : int|string
- max-stale Cache-Control header It can be expressed in seconds or with a relative time format (1 day, 2 weeks, ...).
- $mustRevalidate : bool
- Whether or not the response must be revalidated.
- $public : bool
- Whether the response is public or not.
- $smaxage : int
- The number of seconds that the response is considered fresh by a public cache like a reverse proxy cache.
- $staleIfError : int|string
- stale-if-error Cache-Control header It can be expressed in seconds or with a relative time format (1 day, 2 weeks, ...).
- $staleWhileRevalidate : int|string
- stale-while-revalidate Cache-Control header It can be expressed in seconds or with a relative time format (1 day, 2 weeks, ...).
- $vary : array<string|int, mixed>
- Additional "Vary:"-headers.
- __construct() : mixed
- allowArray() : bool
- Only one cache directive is allowed.
- getAliasName() : string
- Returns the annotation alias name.
- getEtag() : string
- Returns the "ETag"-header expression.
- getExpires() : string
- Returns the expiration date for the Expires header field.
- getLastModified() : string
- Returns the "Last-Modified"-header expression.
- getMaxAge() : int
- Returns the number of seconds the response is considered fresh by a private cache.
- getMaxStale() : int|string
- getSMaxAge() : int
- Returns the number of seconds the response is considered fresh by a public cache.
- getStaleIfError() : int|string
- getStaleWhileRevalidate() : int|string
- getVary() : array<string|int, mixed>
- Returns the custom "Vary"-headers.
- isPrivate() : bool
- Returns whether or not a response is private.
- isPublic() : bool
- Returns whether or not a response is public.
- mustRevalidate() : bool
- setEtag() : mixed
- Sets the "ETag"-header expression.
- setExpires() : mixed
- Sets the expiration date for the Expires header field.
- setLastModified() : mixed
- Sets the "Last-Modified"-header expression.
- setMaxAge() : mixed
- Sets the number of seconds for the max-age cache-control header field.
- setMaxStale() : mixed
- Sets the number of seconds for the max-stale cache-control header field.
- setMustRevalidate() : mixed
- Forces a response to be revalidated.
- setPublic() : mixed
- Sets a response public.
- setSMaxAge() : mixed
- Sets the number of seconds for the s-maxage cache-control header field.
- setStaleIfError() : self
- setStaleWhileRevalidate() : self
- setVary() : mixed
- Add additional "Vary:"-headers.
Properties
$etag
An expression to compute the ETag HTTP header.
private
string
$etag
$expires
The expiration date as a valid date for the strtotime() function.
private
string
$expires
$lastModified
An expression to compute the Last-Modified HTTP header.
private
string
$lastModified
$maxage
The number of seconds that the response is considered fresh by a private cache like a web browser.
private
int
$maxage
$maxStale
max-stale Cache-Control header It can be expressed in seconds or with a relative time format (1 day, 2 weeks, ...).
private
int|string
$maxStale
$mustRevalidate
Whether or not the response must be revalidated.
private
bool
$mustRevalidate
$public
Whether the response is public or not.
private
bool
$public
$smaxage
The number of seconds that the response is considered fresh by a public cache like a reverse proxy cache.
private
int
$smaxage
$staleIfError
stale-if-error Cache-Control header It can be expressed in seconds or with a relative time format (1 day, 2 weeks, ...).
private
int|string
$staleIfError
$staleWhileRevalidate
stale-while-revalidate Cache-Control header It can be expressed in seconds or with a relative time format (1 day, 2 weeks, ...).
private
int|string
$staleWhileRevalidate
$vary
Additional "Vary:"-headers.
private
array<string|int, mixed>
$vary
Methods
__construct()
public
__construct(array<string|int, mixed> $values) : mixed
Parameters
- $values : array<string|int, mixed>
Return values
mixed —allowArray()
Only one cache directive is allowed.
public
allowArray() : bool
Tags
Return values
bool —getAliasName()
Returns the annotation alias name.
public
getAliasName() : string
Tags
Return values
string —getEtag()
Returns the "ETag"-header expression.
public
getEtag() : string
Return values
string —getExpires()
Returns the expiration date for the Expires header field.
public
getExpires() : string
Return values
string —getLastModified()
Returns the "Last-Modified"-header expression.
public
getLastModified() : string
Return values
string —getMaxAge()
Returns the number of seconds the response is considered fresh by a private cache.
public
getMaxAge() : int
Return values
int —getMaxStale()
public
getMaxStale() : int|string
Return values
int|string —getSMaxAge()
Returns the number of seconds the response is considered fresh by a public cache.
public
getSMaxAge() : int
Return values
int —getStaleIfError()
public
getStaleIfError() : int|string
Return values
int|string —getStaleWhileRevalidate()
public
getStaleWhileRevalidate() : int|string
Return values
int|string —getVary()
Returns the custom "Vary"-headers.
public
getVary() : array<string|int, mixed>
Return values
array<string|int, mixed> —isPrivate()
Returns whether or not a response is private.
public
isPrivate() : bool
Return values
bool —isPublic()
Returns whether or not a response is public.
public
isPublic() : bool
Return values
bool —mustRevalidate()
public
mustRevalidate() : bool
Return values
bool —setEtag()
Sets the "ETag"-header expression.
public
setEtag(string $expression) : mixed
Parameters
- $expression : string
Return values
mixed —setExpires()
Sets the expiration date for the Expires header field.
public
setExpires(string $expires) : mixed
Parameters
- $expires : string
-
A valid php date
Return values
mixed —setLastModified()
Sets the "Last-Modified"-header expression.
public
setLastModified(string $expression) : mixed
Parameters
- $expression : string
Return values
mixed —setMaxAge()
Sets the number of seconds for the max-age cache-control header field.
public
setMaxAge(int $maxage) : mixed
Parameters
- $maxage : int
-
A number of seconds
Return values
mixed —setMaxStale()
Sets the number of seconds for the max-stale cache-control header field.
public
setMaxStale(int|string $maxStale) : mixed
Parameters
- $maxStale : int|string
-
A number of seconds
Return values
mixed —setMustRevalidate()
Forces a response to be revalidated.
public
setMustRevalidate(bool $mustRevalidate) : mixed
Parameters
- $mustRevalidate : bool
Return values
mixed —setPublic()
Sets a response public.
public
setPublic(bool $public) : mixed
Parameters
- $public : bool
-
A boolean value
Return values
mixed —setSMaxAge()
Sets the number of seconds for the s-maxage cache-control header field.
public
setSMaxAge(int $smaxage) : mixed
Parameters
- $smaxage : int
-
A number of seconds
Return values
mixed —setStaleIfError()
public
setStaleIfError(int|string $staleIfError) : self
Parameters
- $staleIfError : int|string
Return values
self —setStaleWhileRevalidate()
public
setStaleWhileRevalidate(int|string $staleWhileRevalidate) : self
Parameters
- $staleWhileRevalidate : int|string
Return values
self —setVary()
Add additional "Vary:"-headers.
public
setVary(array<string|int, mixed> $vary) : mixed
Parameters
- $vary : array<string|int, mixed>