@@ -77,23 +77,27 @@ but is a great way to start.
7777
7878 For details on setting up Varnish, see:doc: `/http_cache/varnish `.
7979
80- Enabling the proxy is easy: each application comes with a caching kernel (``AppCache ``)
81- that wraps the default one (``AppKernel ``). The caching Kernel *is * the reverse
82- proxy.
80+ To enable the proxy, first create a caching kernel::
8381
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::
82+ // src/CacheKernel.php
83+ use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
84+
85+ class CacheKernel extends HttpCache
86+ {
87+ }
88+
89+ Modify the code of your front controller to wrap the default kernel into the
90+ caching kernel:
91+
92+ ..code-block ::diff
8693
8794 // public/index.php
88- use Symfony\Component\HttpFoundation\Request;
8995
9096 // ...
91- $kernel = new AppKernel('prod', false);
92- $kernel->loadClassCache();
97+ $kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev')));
9398
94- // add (or uncomment) this new line!
95- // wrap the default Kernel with the AppCache one
96- $kernel = new AppCache($kernel);
99+ + // Wrap the default Kernel with the CacheKernel one
100+ + $kernel = new CacheKernel($kernel);
97101
98102 $request = Request::createFromGlobals();
99103 // ...
@@ -115,15 +119,15 @@ from your application and returning them to the client.
115119
116120 error_log($kernel->getLog());
117121
118- The ``AppCache `` object has a sensible default configuration, but it can be
122+ The ``CacheKernel `` object has a sensible default configuration, but it can be
119123finely tuned via a set of options you can set by overriding the
120124:method: `Symfony\\ Bundle\\ FrameworkBundle\\ HttpCache\\ HttpCache::getOptions `
121125method::
122126
123- //app/AppCache .php
127+ //src/CacheKernel .php
124128 use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
125129
126- classAppCache extends HttpCache
130+ classCacheKernel extends HttpCache
127131 {
128132 protected function getOptions()
129133 {
@@ -150,7 +154,7 @@ information about cache hits and misses.
150154 website or when you deploy your website to a shared host where you cannot
151155 install anything beyond PHP code. But being written in PHP, it cannot
152156 be as fast as a proxy written in C.
153-
157+
154158 Fortunately, since all reverse proxies are effectively the same, you should
155159 be able to switch to something more robust - like Varnish - without any problems.
156160 See:doc: `How to use Varnish </http_cache/varnish >`
@@ -192,7 +196,7 @@ These four headers are used to help cache your responses via *two* different mod
192196
193197 All of the HTTP headers you'll read about are *not * invented by Symfony! They're
194198 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
199+ into HTTP Caching, check out the documents `RFC 7234 - Caching `_ and
196200 `RFC 7232 - Conditional Requests `_.
197201
198202 As a web developer, you are strongly urged to read the specification. Its