SilverStripe\EnvironmentCheck\Checks\CacheHeadersCheck
Check cache headers for any response, can specify directives that must be included and also must be excluded from Cache-Control headers in response. Also checks for existence of ETag.
Synopsis
class CacheHeadersCheck
implements
EnvironmentCheck
{
- // members
- protected array $mustInclude = ;
- protected array $mustExclude = ;
- protected ValidationResult $result;
- // methods
- public void __construct()
- public void check()
- private string getMessage()
- private void checkEtag()
- private void checkCacheControl()
Hierarchy
Uses
Implements
Constants
Name | Value |
---|---|
ERROR | 3 |
WARNING | 2 |
OK | 1 |
Members
protected
- $mustExclude
—
array
Settings that must be excluded in the Cache-Control header - $mustInclude
—
array
Settings that must be included in the Cache-Control header - $result
—
SilverStripe\ORM\ValidationResult
Result to keep track of status and messages for all checks, reuses ValidationResult for convenience. - $url
—
string
Absolute URL for requests.
public
- $client
—
SilverStripe\EnvironmentCheck\Traits\GuzzleHttp\Client
Client for making requests, set vi Injector.
Methods
private
- checkCacheControl() — Check that the correct header settings are either included or excluded.
- checkEtag() — Check that ETag header exists
- getMessage() — Collate messages from ValidationResult so that it is clear which parts of the check passed and which failed.
public
- __construct() — Set up with URL, arrays of header settings to check.
- check() — Check that correct caching headers are present.