PAGE Methods

expires()

Set current page's cache-control and last-modified datetime.

bool expires([ int hours ])

Return

TRUE if expiry date lies in the future

Parameter
Description
hoursBrowser cache-control setting (= hours from now). If you put a value <= 0 the page will not be cached by the browser.

No browser caching

$PAGE->expires(0)
RETURN: 'Expires: Fri, 19 Aug 2022 16:29:29 GMT; Cache-Control: no-store; Last-Modified: Fri, 19 Aug 2022 17:29:29 GMT;'

Activate browser caching

$PAGE->expires(8)
RETURN: 'Expires: Sat, 20 Aug 2022 00:00:00 GMT; Cache-Control: public, max-age=28800; Last-Modified: Fri, 19 Aug 2022 16:00:00 GMT;'