diff --git a/changelog/_unreleased/2022-07-05-make-used-httpcache-class-customizable.md b/changelog/_unreleased/2022-07-05-make-used-httpcache-class-customizable.md new file mode 100644 index 00000000000..904f5381183 --- /dev/null +++ b/changelog/_unreleased/2022-07-05-make-used-httpcache-class-customizable.md @@ -0,0 +1,9 @@ +--- +title: make used HttpCache-class customizable +issue: NEXT-22356 +author: Sven Herrmann +author_email: sven.herrmann@ianeo.de +author_github: @SvenHerrmann +--- +# Core +* Added static property `$httpCacheClass` to `src/Core/HttpKernel.php` to make the used HttpCache-class customizable (similar to Kernel-class) diff --git a/src/Core/HttpKernel.php b/src/Core/HttpKernel.php index 8f53304c07f..d5d878160f6 100644 --- a/src/Core/HttpKernel.php +++ b/src/Core/HttpKernel.php @@ -36,6 +36,11 @@ class HttpKernel */ protected static $kernelClass = Kernel::class; + /** + * @var class-string + */ + protected static string $httpCacheClass = HttpCache::class; + /** * @var ClassLoader|null */ @@ -147,7 +152,7 @@ private function doHandle(Request $request, int $type, bool $catch): HttpKernelR $enabled = $container->hasParameter('shopware.http.cache.enabled') && $container->getParameter('shopware.http.cache.enabled'); if ($enabled && $container->has(CacheStore::class)) { - $kernel = new HttpCache($kernel, $container->get(CacheStore::class), null, ['debug' => $this->debug]); + $kernel = new static::$httpCacheClass($kernel, $container->get(CacheStore::class), null, ['debug' => $this->debug]); } $response = $kernel->handle($transformed, $type, $catch);