Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7e18b72

Browse filesBrowse files
bug #59581 [Cache] Don't clear system caches on cache:clear (nicolas-grekas)
This PR was merged into the 6.4 branch. Discussion ---------- [Cache] Don't clear system caches on `cache:clear` | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #59445 | License | MIT As spotted by `@MatTheCat` in symfony/symfony#59445 (comment), non-optional cache warmers currently cannot use any cache pools derived from the `cache.system` one. The reason is that when running `cache:clear` with no `var/cache` folder, we skip running those cache warmers since they already ran to execute the command, but we still call the cache clearer service, which empties system pools at the moment, annihilating anything non-optional cache warmers put in these pools. I propose to fix this by just not clearing cache pools derived from the system pool anymore. System pools are meant to we stored in the `kernel.cache_dir` anyway, so they're already cleared when `cache:clear` empties that folder. Commits ------- 8e820561295 [Cache] Don't clear system caches on cache:clear
2 parents 5791a99 + f14292b commit 7e18b72
Copy full SHA for 7e18b72

File tree

3 files changed

+12
-17
lines changed
Filter options

3 files changed

+12
-17
lines changed

‎Tests/Functional/CachePoolsTest.php

Copy file name to clipboardExpand all lines: Tests/Functional/CachePoolsTest.php
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ private function doTestCachePools($options, $adapterClass)
8888
$pool2 = $container->get('cache.pool2');
8989
$pool2->save($item);
9090

91-
$container->get('cache_clearer.alias')->clear($container->getParameter('kernel.cache_dir'));
92-
$item = $pool1->getItem($key);
93-
$this->assertFalse($item->isHit());
94-
9591
$item = $pool2->getItem($key);
9692
$this->assertTrue($item->isHit());
9793

‎Tests/Functional/ContainerDebugCommandTest.php

Copy file name to clipboardExpand all lines: Tests/Functional/ContainerDebugCommandTest.php
+12-8Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,18 @@ public function testTagsPartialSearch()
139139
$tester->setInputs(['0']);
140140
$tester->run(['command' => 'debug:container', '--tag' => 'kernel.'], ['decorated' => false]);
141141

142-
$this->assertStringContainsString('Select one of the following tags to display its information', $tester->getDisplay());
143-
$this->assertStringContainsString('[0] kernel.cache_clearer', $tester->getDisplay());
144-
$this->assertStringContainsString('[1] kernel.cache_warmer', $tester->getDisplay());
145-
$this->assertStringContainsString('[2] kernel.event_subscriber', $tester->getDisplay());
146-
$this->assertStringContainsString('[3] kernel.fragment_renderer', $tester->getDisplay());
147-
$this->assertStringContainsString('[4] kernel.locale_aware', $tester->getDisplay());
148-
$this->assertStringContainsString('[5] kernel.reset', $tester->getDisplay());
149-
$this->assertStringContainsString('Symfony Container Services Tagged with "kernel.cache_clearer" Tag', $tester->getDisplay());
142+
$this->assertStringMatchesFormat(<<<EOTXT
143+
144+
Select one of the following tags to display its information:
145+
%A
146+
[%d] kernel.reset
147+
%A
148+
149+
Symfony Container Services Tagged with "kernel.%a" Tag
150+
%A
151+
EOTXT,
152+
$tester->getDisplay()
153+
);
150154
}
151155

152156
public function testDescribeEnvVars()
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
11
imports:
22
- { resource: ../config/default.yml }
3-
4-
services:
5-
cache_clearer.alias:
6-
alias: cache_clearer
7-
public: true

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.