drupal_page_is_cacheable

Versions
7
drupal_page_is_cacheable($allow_caching = NULL)

Determine the cacheability of the current page.

Parameters

$allow_caching Set to FALSE if you want to prevent this page to get cached.

Return value

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

▾ 6 functions call drupal_page_is_cacheable()

drupal_page_get_cache in includes/bootstrap.inc
Retrieve the current page from the cache.
drupal_page_set_cache in includes/common.inc
Store the current page in the cache.
drupal_session_initialize in includes/session.inc
Initialize the session handler, starting a session if needed.
drupal_set_message in includes/bootstrap.inc
Set a message which reflects the status of the performed operation.
image_style_url in modules/image/image.module
Return the URL for an image derivative given a style and image path.
_drupal_bootstrap_page_header in includes/bootstrap.inc
Bootstrap page header: Invoke hook_boot(), intialize locking system, and send default HTTP headers.

Code

includes/bootstrap.inc, line 824

<?php
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();
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.