PHP Class Webiny\Component\Http\Response\CacheControl

Inheritance: use trait Webiny\Component\StdLib\StdObjectTrait
显示文件 Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
__construct ( ) Base constructor.
getCacheControl ( ) : array Returns the current cache control headers as an array.
setAsCache ( DateTimeObject $expirationDate ) Populates the cache control headers with options so that the browser caches the content.
setAsDontCache ( ) Populates the current cache control headers with options so the content is not cached by the browser.
setCacheControl ( array $cacheControl ) Overwrites the current cache control headers.
setCacheControlEntry ( string $key, string $value ) Sets or adds an entry to cache control headers.

Private Methods

Method Description
validateCacheControlHeader ( string $header ) : boolean Checks if the give header name is a valid cache control header.

Method Details

__construct() public method

Base constructor.
public __construct ( )

getCacheControl() public method

Returns the current cache control headers as an array.
public getCacheControl ( ) : array
return array

setAsCache() public method

Populates the cache control headers with options so that the browser caches the content.
public setAsCache ( DateTimeObject $expirationDate )
$expirationDate Webiny\Component\StdLib\StdObject\DateTimeObject\DateTimeObject Defines the date when the cache should expire.

setAsDontCache() public method

These headers are returned with each response by default.
public setAsDontCache ( )

setCacheControl() public method

Overwrites the current cache control headers.
public setCacheControl ( array $cacheControl )
$cacheControl array Array containing new cache control headers.

setCacheControlEntry() public method

Sets or adds an entry to cache control headers.
public setCacheControlEntry ( string $key, string $value )
$key string Cache control header name.
$value string Cache control header value.