From 2133ec4fc0df3e158b3b5d4974b4b82d68b10a9c Mon Sep 17 00:00:00 2001 From: helmi <43951764+helmis123@users.noreply.github.com> Date: Thu, 25 Nov 2021 15:29:07 +0100 Subject: [PATCH] Update http_cache.rst Update CacheKernel implementation in public/index.php Removal of "$request" which was moved to SymfonyRuntime --- http_cache.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/http_cache.rst b/http_cache.rst index 35620d1cd76..59ca7e19526 100644 --- a/http_cache.rst +++ b/http_cache.rst @@ -98,15 +98,14 @@ caching kernel: + use App\CacheKernel; use App\Kernel; - // ... - $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); + // ... + $kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); + // Wrap the default Kernel with the CacheKernel one in 'prod' environment + if ('prod' === $kernel->getEnvironment()) { - + $kernel = new CacheKernel($kernel); + + return new CacheKernel($kernel); + } + return $kernel; - $request = Request::createFromGlobals(); - // ... The caching kernel will immediately act as a reverse proxy: caching responses from your application and returning them to the client.