function RenderCache::isCacheableForCurrentHttpMethod
Checks if a set of cache tags are cacheable for the current HTTP method.
This will return TRUE if the method is cacheable, regardless of which cache tags were provided. Otherwise, it will only return TRUE if no cache tags started with the CACHE_MISS_IF_UNCACHEABLE_HTTP_METHOD: prefix.
Parameters
array $tags: The cache tags to check.
Return value
bool Whether the cache tags allow caching for the current HTTP method.
2 calls to RenderCache::isCacheableForCurrentHttpMethod()
- RenderCache::get in core/
lib/ Drupal/ Core/ Render/ RenderCache.php - Gets the cached, pre-rendered element of a renderable element from cache.
- RenderCache::getMultiple in core/
lib/ Drupal/ Core/ Render/ RenderCache.php - Gets multiple cached, pre-rendered elements from cache.
File
-
core/
lib/ Drupal/ Core/ Render/ RenderCache.php, line 99
Class
- RenderCache
- Wraps the caching logic for the render caching system.
Namespace
Drupal\Core\RenderCode
protected function isCacheableForCurrentHttpMethod(array $tags) : bool {
return $this->requestStack
->getCurrentRequest()
->isMethodCacheable() || empty(array_filter($tags, fn(string $tag) => str_starts_with($tag, 'CACHE_MISS_IF_UNCACHEABLE_HTTP_METHOD:')));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.