Based on the work in #2378789: Views output cache is broken and discussions emanating from it, we realized that the current render array API and Render API forces modules wanting to do their own output/render caching aware of :
$element['#attached']
(assets + placeholders)$element['#cache']['max-age']
$element['#cache']['contexts']
$element['#cache']['tags']
Ideally, that wouldn't have been necessary; ideally they would just have to call a method on the RenderCache
service to get the cacheable representation of a rendered render array. This issue is about adding that.
(This may seem very minor, but long-term benefits of this include better support for HTTP caching, e.g. adding a "max age" (max-age was added since!) "min-age" property to the #cache
key of render arrays in a later D8 release, with zero API breakage or logic breakage thanks to this API addition.)
- Added
RenderCache::getCacheableRenderArray()
- Removed
drupal_render_cache_get()
- Removed
drupal_render_cache_set()
- Removed
drupal_render_cid_create()