protected RenderCache::createCacheID(array &$elements)
Creates the cache ID for a renderable element.
Creates the cache ID string based on #cache['keys'] + #cache['contexts'].
Parameters
array &$elements: A renderable array.
Return value
string The cache ID string, or FALSE if the element may not be cached.
File
- core/lib/Drupal/Core/Render/RenderCache.php, line 298
Class
- RenderCache
- Wraps the caching logic for the render caching system.
Namespace
Drupal\Core\Render
Code
protected function createCacheID(array &$elements) { // If the maximum age is zero, then caching is effectively prohibited. if (isset($elements['#cache']['max-age']) && $elements['#cache']['max-age'] === 0) { return FALSE; } if (isset($elements['#cache']['keys'])) { $cid_parts = $elements['#cache']['keys']; if (!empty($elements['#cache']['contexts'])) { $context_cache_keys = $this->cacheContextsManager->convertTokensToKeys($elements['#cache']['contexts']); $cid_parts = array_merge($cid_parts, $context_cache_keys->getKeys()); CacheableMetadata::createFromRenderArray($elements) ->merge($context_cache_keys) ->applyTo($elements); } return implode(':', $cid_parts); } return FALSE; }
Please login to continue.