@@ -81,18 +81,15 @@ Enabling the proxy is easy: each application comes with a caching kernel (``AppC
8181that wraps the default one (``AppKernel ``). The caching Kernel *is * the reverse
8282proxy.
8383
84- To enable caching, modify the code of your front controller. You can also make these
85- changes to ``index.php `` to add caching to the ``dev `` environment::
84+ To enable caching, modify the code of your ``index.php `` front controller::
8685
8786 // public/index.php
8887 use Symfony\Component\HttpFoundation\Request;
8988
9089 // ...
91- $kernel = new AppKernel('prod', false);
92- $kernel->loadClassCache();
90+ $kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? false);
9391
94- // add (or uncomment) this new line!
95- // wrap the default Kernel with the AppCache one
92+ // add (or uncomment) this line to wrap the default Kernel with the AppCache one
9693 $kernel = new AppCache($kernel);
9794
9895 $request = Request::createFromGlobals();
@@ -120,7 +117,9 @@ finely tuned via a set of options you can set by overriding the
120117:method: `Symfony\\ Bundle\\ FrameworkBundle\\ HttpCache\\ HttpCache::getOptions `
121118method::
122119
123- // app/AppCache.php
120+ // src/AppCache.php
121+ namespace App;
122+
124123 use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
125124
126125 class AppCache extends HttpCache
@@ -137,10 +136,9 @@ method::
137136For a full list of the options and their meaning, see the
138137:method: `HttpCache::__construct() documentation <Symfony\\ Component\\ HttpKernel\\ HttpCache\\ HttpCache::__construct> `.
139138
140- When you're in debug mode (either because your booting a ``debug `` kernel, like
141- in ``index.php `` *or * you manually set the ``debug `` option to true), Symfony
142- automatically adds an ``X-Symfony-Cache `` header to the response. Use this to get
143- information about cache hits and misses.
139+ When you're in debug mode (the second argument of ``Kernel `` constructor in the
140+ front controller is ``true ``), Symfony automatically adds an ``X-Symfony-Cache ``
141+ header to the response. Use this to get information about cache hits and misses.
144142
145143.. _http-cache-symfony-versus-varnish :
146144
@@ -150,7 +148,7 @@ information about cache hits and misses.
150148 website or when you deploy your website to a shared host where you cannot
151149 install anything beyond PHP code. But being written in PHP, it cannot
152150 be as fast as a proxy written in C.
153-
151+
154152 Fortunately, since all reverse proxies are effectively the same, you should
155153 be able to switch to something more robust - like Varnish - without any problems.
156154 See:doc: `How to use Varnish </http_cache/varnish >`
@@ -192,7 +190,7 @@ These four headers are used to help cache your responses via *two* different mod
192190
193191 All of the HTTP headers you'll read about are *not * invented by Symfony! They're
194192 part of an HTTP specification that's used by sites all over the web. To dig deeper
195- into HTTP Caching, check out the documents `RFC 7234 - Caching `_ and
193+ into HTTP Caching, check out the documents `RFC 7234 - Caching `_ and
196194 `RFC 7232 - Conditional Requests `_.
197195
198196 As a web developer, you are strongly urged to read the specification. Its
@@ -214,7 +212,7 @@ The *easiest* way to cache a response is by caching it for a specific amount of
214212 use Symfony\Component\HttpFoundation\Response;
215213 // ...
216214
217- public functionindexAction ()
215+ public functionindex ()
218216 {
219217 // somehow create a Response object, like by rendering a template
220218 $response = $this->render('blog/index.html.twig', []);