Home > PHP > Function > > HttpResponse::setCacheControl()

HttpResponse::setCacheControl()

HttpResponse::setCacheControl - Set cache control

Syntax

static HttpResponse::setCacheControl (string $control, int $max_age, bool $must_revalidate)

Arguments

  • control - the primary cache control setting
  • max_age - the max-age in seconds, suggesting how long the cache entry is valid on the client side
  • must_revalidate - whether the cached entity should be revalidated by the client for every request

Description

Define a custom Cache-Controlheader, usually being privateor public;

Version

PHP PECL pecl_http >= 0.10.0

Return value

Returns TRUE on success, or FALSE if control does not match one of public, privateor no-cache.