-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "Disable fine-grained caching" checker (#282)
* Add "Disable fine-grained caching" checker * Add cache tagging config fallback
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
src/Components/Health/Checker/PerformanceChecker/FineGrainedCachingChecker.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Frosh\Tools\Components\Health\Checker\PerformanceChecker; | ||
|
||
use Frosh\Tools\Components\Health\Checker\CheckerInterface; | ||
use Frosh\Tools\Components\Health\HealthCollection; | ||
use Frosh\Tools\Components\Health\SettingsResult; | ||
use Symfony\Component\DependencyInjection\Attribute\Autowire; | ||
|
||
class FineGrainedCachingChecker implements PerformanceCheckerInterface, CheckerInterface | ||
{ | ||
public const DOCUMENTATION_URL = 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#disable-fine-grained-caching'; | ||
|
||
public function __construct( | ||
#[Autowire('%kernel.shopware_version%')] | ||
public readonly string $shopwareVersion, | ||
#[Autowire('%shopware.cache.tagging.each_config%')] | ||
public readonly bool $cacheTaggingEachConfig, | ||
#[Autowire('%shopware.cache.tagging.each_snippet%')] | ||
public readonly bool $cacheTaggingEachSnippet, | ||
#[Autowire('%shopware.cache.tagging.each_theme_config%')] | ||
public readonly bool $cacheTaggingEachThemeConfig, | ||
) {} | ||
|
||
public function collect(HealthCollection $collection): void | ||
{ | ||
if (\version_compare('6.5.4.0', $this->shopwareVersion, '>')) { | ||
return; | ||
} | ||
|
||
if ($this->cacheTaggingEachConfig || $this->cacheTaggingEachSnippet || $this->cacheTaggingEachThemeConfig) { | ||
$collection->add( | ||
// only info, because it only affects redis, varnish etc. | ||
SettingsResult::info( | ||
'fine-grained-caching', | ||
'Fine-grained caching on Redis, Varnish etc.', | ||
'enabled', | ||
'disabled', | ||
self::DOCUMENTATION_URL, | ||
), | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters