function RenderCache::get
Same name in other branches
- 9 core/lib/Drupal/Core/Render/RenderCache.php \Drupal\Core\Render\RenderCache::get()
- 8.9.x core/lib/Drupal/Core/Render/RenderCache.php \Drupal\Core\Render\RenderCache::get()
- 10 core/lib/Drupal/Core/Render/RenderCache.php \Drupal\Core\Render\RenderCache::get()
Overrides RenderCacheInterface::get
1 call to RenderCache::get()
- PlaceholderingRenderCache::get in core/
lib/ Drupal/ Core/ Render/ PlaceholderingRenderCache.php - Gets the cached, pre-rendered element of a renderable element from cache.
1 method overrides RenderCache::get()
- PlaceholderingRenderCache::get in core/
lib/ Drupal/ Core/ Render/ PlaceholderingRenderCache.php - Gets the cached, pre-rendered element of a renderable element from cache.
File
-
core/
lib/ Drupal/ Core/ Render/ RenderCache.php, line 37
Class
- RenderCache
- Wraps the caching logic for the render caching system.
Namespace
Drupal\Core\RenderCode
public function get(array $elements) {
if (!$this->isElementCacheable($elements)) {
return FALSE;
}
$bin = $elements['#cache']['bin'] ?? 'render';
if (($cache_bin = $this->cacheFactory
->get($bin)) && ($cache = $cache_bin->get($elements['#cache']['keys'], CacheableMetadata::createFromRenderArray($elements)))) {
if (!$this->requestStack
->getCurrentRequest()
->isMethodCacheable()) {
if (!empty(array_filter($cache->tags, fn(string $tag) => str_starts_with($tag, 'CACHE_MISS_IF_UNCACHEABLE_HTTP_METHOD:')))) {
return FALSE;
}
}
return $cache->data;
}
return FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.