function drupal_render_cache_get

Gets the rendered output of a renderable element from the cache.

Parameters

$elements: A renderable array.

Return value

A markup string containing the rendered content of the element, or FALSE if no cached copy of the element is available.

See also

drupal_render()

drupal_render_cache_set()

2 calls to drupal_render_cache_get()
drupal_render in drupal/core/includes/common.inc
Renders HTML given a structured array tree.
RenderTest::testDrupalRenderChildrenAttached in drupal/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php
Tests #attached functionality in children elements.

File

drupal/core/includes/common.inc, line 5637
Common functions that many Drupal modules will need to reference.

Code

function drupal_render_cache_get($elements) {
  if (!in_array($_SERVER['REQUEST_METHOD'], array(
    'GET',
    'HEAD',
  )) || !($cid = drupal_render_cid_create($elements))) {
    return FALSE;
  }
  $bin = isset($elements['#cache']['bin']) ? $elements['#cache']['bin'] : 'cache';
  if (!empty($cid) && ($cache = cache($bin)
    ->get($cid))) {

    // Add additional libraries, JavaScript, CSS and other data attached
    // to this element.
    if (isset($cache->data['#attached'])) {
      drupal_process_attached($cache->data);
    }

    // Return the rendered output.
    return $cache->data['#markup'];
  }
  return FALSE;
}