function drupal_page_is_cacheable

drupal_page_is_cacheable($allow_caching = NULL)

Determines the cacheability of the current page.

Parameters

$allow_caching: Set to FALSE if you want to prevent this page from being cached.

Return value

TRUE if the current page can be cached, FALSE otherwise.

File

includes/bootstrap.inc, line 1302
Functions that need to be loaded on every Drupal request.

Code

function drupal_page_is_cacheable($allow_caching = NULL) {
  $allow_caching_static = &drupal_static(__FUNCTION__, TRUE);
  if (isset($allow_caching)) {
    $allow_caching_static = $allow_caching;
  }

  return $allow_caching_static && ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD')
    && !drupal_is_cli();
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!bootstrap.inc/function/drupal_page_is_cacheable/7.x