drupal_render_cid_create

Versions
7
drupal_render_cid_create($elements)

Create the cache ID for a renderable element.

This creates the cache ID string, either by returning the #cache['cid'] property if present or by building the cache ID out of the #cache['keys'] and, optionally, the #cache['granularity'] properties.

Parameters

$elements A renderable array.

Return value

The cache ID string, or FALSE if the element may not be cached.

▾ 2 functions call drupal_render_cid_create()

drupal_render_cache_get in includes/common.inc
Get the rendered output of a renderable element from cache.
drupal_render_cache_set in includes/common.inc
Cache the rendered output of a renderable element.

Code

includes/common.inc, line 5290

<?php
function drupal_render_cid_create($elements) {
  if (isset($elements['#cache']['cid'])) {
    return $elements['#cache']['cid'];
  }
  elseif (isset($elements['#cache']['keys'])) {
    $granularity = isset($elements['#cache']['granularity']) ? $elements['#cache']['granularity'] : NULL;
    // Merge in additional cache ID parts based provided by drupal_render_cid_parts().
    $cid_parts = array_merge($elements['#cache']['keys'], drupal_render_cid_parts($granularity));
    return implode(':', $cid_parts);
  }
  return FALSE;
}
?>
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.