You are here

function render_cache_call_is_cacheable in Render cache 7.2

Check if this call should / can be served from the cache.

By default only GET and / or HEAD requests are cacheable.

Parameters

bool $allow_caching: Set to FALSE if you want to prevent this call to get the cached version and / or fill the cache.

bool $ignore_request_method_check: Set to TRUE if you want to ignore the request method check.

Return value

bool TRUE if the current call can be cached, FALSE otherwise.

See also

drupal_page_is_cacheable()

2 calls to render_cache_call_is_cacheable()
BaseController::isCacheable in src/RenderCache/Controller/BaseController.php
render_cache_page_deliver_html_page in modules/controller/render_cache_page/render_cache_page.module
Overrides drupal_deliver_html_page().

File

./render_cache.module, line 113
Main module file for the Render Cache caching system.

Code

function render_cache_call_is_cacheable($allow_caching = NULL, $ignore_request_method_check = FALSE) {
  $allow_caching_static =& drupal_static(__FUNCTION__, TRUE);
  if (isset($allow_caching)) {
    $allow_caching_static = $allow_caching;
  }
  return $allow_caching_static && ($ignore_request_method_check || ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD')) && !drupal_is_cli();
}