You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #17972 [HttpCache] Explain how to extend the HttpCache class (HypeMC)
This PR was merged into the 5.4 branch.
Discussion
----------
[HttpCache] Explain how to extend the `HttpCache` class
Followup to #16402.
In versions of Symfony prior to 5.4 the caching kernel was enabled by wrapping the default kernel into it inside the front controller, eg:
```php
// public/index.php
use App\CacheKernel;
use App\Kernel;
// ...
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
// Wrap the default Kernel with the CacheKernel one in 'prod' environment
if ('prod' === $kernel->getEnvironment()) {
$kernel = new CacheKernel($kernel);
}
```
Starting from version 5.4 this was changed to be done through the configuration:
```yaml
# config/packages/framework.yaml
when@prod:
framework:
http_cache: true
```
However, it was never explained how the caching kernel can be extended in this case. Decorating the `http_cache` service seems like the best option.
Commits
-------
34809dd [HttpCache] Explain how to extend the HttpCache class
0 commit comments