Skip to content

Commit

Permalink
Merge branch 'next-22356/auto-imported-from-github' into 'trunk'
Browse files Browse the repository at this point in the history
NEXT-22356 - make the used HttpCache-class customizable (similar to Kernel-class)

See merge request shopware/6/product/platform!8469
  • Loading branch information
shyim committed Jul 29, 2022
2 parents 7a1f2c8 + 79d61ea commit 678156a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: make used HttpCache-class customizable
issue: NEXT-22356
author: Sven Herrmann
author_email: [email protected]
author_github: @SvenHerrmann
---
# Core
* Added static property `$httpCacheClass` to `src/Core/HttpKernel.php` to make the used HttpCache-class customizable (similar to Kernel-class)
7 changes: 6 additions & 1 deletion src/Core/HttpKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ class HttpKernel
*/
protected static $kernelClass = Kernel::class;

/**
* @var class-string<HttpCache>
*/
protected static string $httpCacheClass = HttpCache::class;

/**
* @var ClassLoader|null
*/
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 678156a

Please sign in to comment.