You are here

function ape_set_cache_header in Advanced Page Expiration 7

Sets the cache control header.

Parameters

int $max_age: The cache expiration age, in seconds.

3 calls to ape_set_cache_header()
ape_drupal_goto_alter in ./ape.module
Implements hook_drupal_goto_alter().
ape_page_delivery_callback_alter in ./ape.module
Implements hook_page_delivery_callback_alter().
ape_redirect_alter in ./ape.module
Implements hook_redirect_alter().

File

./ape.module, line 207
Allows finer control of the Cache Control header.

Code

function ape_set_cache_header($max_age) {
  $name = 'Cache-Control';
  $value = 'no-cache, must-revalidate, post-check=0, pre-check=0';
  if ($max_age > 0 && ape_check_cacheable()) {
    $value = 'public, max-age=' . $max_age;
  }
  drupal_add_http_header($name, $value);
}