comparison core/lib/Drupal/Core/Render/RenderCacheInterface.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Core\Render;
4
5 /**
6 * Defines an interface for caching rendered render arrays.
7 *
8 * @internal
9 *
10 * @see sec_caching
11 * @see \Drupal\Core\Render\RendererInterface
12 */
13 interface RenderCacheInterface {
14
15 /**
16 * Gets a cacheable render array for a render array and its rendered output.
17 *
18 * Given a render array and its rendered output (HTML string), return an array
19 * data structure that allows the render array and its associated metadata to
20 * be cached reliably (and is serialization-safe).
21 *
22 * If Drupal needs additional rendering metadata to be cached at some point,
23 * consumers of this method will continue to work. Those who only cache
24 * certain parts of a render array will cease to work.
25 *
26 * @param array $elements
27 * A render array, on which \Drupal\Core\Render\RendererInterface::render()
28 * has already been invoked.
29 *
30 * @return array
31 * An array representing the cacheable data for this render array.
32 */
33 public function getCacheableRenderArray(array $elements);
34
35 /**
36 * Gets the cached, pre-rendered element of a renderable element from cache.
37 *
38 * @param array $elements
39 * A renderable array.
40 *
41 * @return array|false
42 * A renderable array, with the original element and all its children pre-
43 * rendered, or FALSE if no cached copy of the element is available.
44 *
45 * @see \Drupal\Core\Render\RendererInterface::render()
46 * @see ::set()
47 */
48 public function get(array $elements);
49
50 /**
51 * Caches the rendered output of a renderable array.
52 *
53 * May be called by an implementation of \Drupal\Core\Render\RendererInterface
54 * while rendering, if the #cache property is set.
55 *
56 * @param array $elements
57 * A renderable array.
58 * @param array $pre_bubbling_elements
59 * A renderable array corresponding to the state (in particular, the
60 * cacheability metadata) of $elements prior to the beginning of its
61 * rendering process, and therefore before any bubbling of child
62 * information has taken place. Only the #cache property is used by this
63 * function, so the caller may omit all other properties and children from
64 * this array.
65 *
66 * @return bool|null
67 * Returns FALSE if no cache item could be created, NULL otherwise.
68 *
69 * @see ::get()
70 */
71 public function set(array &$elements, array $pre_bubbling_elements);
72
73 }