Skip to content

Kirby 3.6.6

$responder->expires()

Setter and getter for the cache expiry timestamp for Kirby's cache

$responder->expires(int|string|null $expires = null, bool $override = false): int|null|Kirby\Cms\Responder

Parameters

Name Type Default Description
$expires int|string|null null Timestamp, number of minutes or time string to parse
$override bool false If true, the already defined timestamp will be overridden

Return type

int|null|Kirby\Cms\Responder

This method modifies the existing $responder object it is applied to and returns it again.

Parent class

Kirby\Cms\Responder

Example

<?php

return function ($kirby) {
  $results = yourApi();

  $kirby->response()->expires(1234567890);   // timestamp OR
  $kirby->response()->expires(60);           // minutes   OR
  $kirby->response()->expires('2021-12-31'); // time string

  return compact('results');
};