Skip to content

Commit 46c6c02

Browse files
committed
Improved the front controller of the HttpCache
1 parent a0d6bb0 commit 46c6c02

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

http_cache.rst

+9-4
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,19 @@ caching kernel:
9595
9696
// public/index.php
9797
98-
use App\Kernel;
9998
+ use App\CacheKernel;
99+
use App\Kernel;
100100
101101
// ...
102-
$kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', $_SERVER['APP_DEBUG'] ?? ('prod' !== ($_SERVER['APP_ENV'] ?? 'dev')));
102+
$env = $_SERVER['APP_ENV'] ?? 'dev';
103+
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env));
104+
// ...
105+
$kernel = new Kernel($env, $debug);
103106
104-
+ // Wrap the default Kernel with the CacheKernel one
105-
+ $kernel = new CacheKernel($kernel);
107+
+ // Wrap the default Kernel with the CacheKernel one in 'prod' environment
108+
+ if ('prod' === $env) {
109+
+ $kernel = new CacheKernel($kernel);
110+
+ }
106111
107112
$request = Request::createFromGlobals();
108113
// ...

0 commit comments

Comments
 (0)