protected PageCache::get(Request $request, $allow_invalid = FALSE)
Returns a response object from the page cache.
Parameters
\Symfony\Component\HttpFoundation\Request $request: A request object.
bool $allow_invalid: (optional) If TRUE, a cache item may be returned even if it is expired or has been invalidated. Such items may sometimes be preferred, if the alternative is recalculating the value stored in the cache, especially if another concurrent request is already recalculating the same value. The "valid" property of the returned object indicates whether the item is valid or not. Defaults to FALSE.
Return value
\Symfony\Component\HttpFoundation\Response|false The cached response or FALSE on failure.
File
- core/modules/page_cache/src/StackMiddleware/PageCache.php, line 298
Class
- PageCache
- Executes the page caching before the main kernel takes over the request.
Namespace
Drupal\page_cache\StackMiddleware
Code
protected function get(Request $request, $allow_invalid = FALSE) { $cid = $this->getCacheId($request); if ($cache = $this->cache->get($cid, $allow_invalid)) { return $cache->data; } return FALSE; }
Please login to continue.