You are here

protected property PlaceholderingRenderCache::$placeholderResultsCache in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php \Drupal\Core\Render\PlaceholderingRenderCache::placeholderResultsCache

Stores rendered results for automatically placeholdered elements.

This allows us to avoid talking to the cache twice per auto-placeholdered element, or in case of an uncacheable element, to render it twice.

Scenario A. The double cache read would happen because: 1. when rendering, cache read, but auto-placeholdered 2. when rendering placeholders, again cache read

Scenario B. The cache write plus read would happen because: 1. when rendering, cache write, but auto-placeholdered 2. when rendering placeholders, cache read

Scenario C. The double rendering for an uncacheable element would happen because: 1. when rendering, not cacheable, but auto-placeholdered 2. when rendering placeholders, rendered again

In all three scenarios, this static cache avoids the second step, thus avoiding expensive work.

Type: array

File

core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php, line 72

Class

PlaceholderingRenderCache
Adds automatic placeholdering to the RenderCache.

Namespace

Drupal\Core\Render

Code

protected $placeholderResultsCache = [];