Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b0c04f8

Browse files
[FrameworkBundle] Don't clear app pools on cache:clear
1 parent 09afa64 commit b0c04f8

File tree

9 files changed

+19
-6
lines changed

9 files changed

+19
-6
lines changed

UPGRADE-3.4.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ Form
113113
FrameworkBundle
114114
---------------
115115

116+
* The `cache:clear` command doesn't clear "app" PSR-6 cache pools anymore,
117+
but still clears "system" ones.
118+
Use the `cache:pool:clear` command to clear "app" pools instead.
119+
116120
* The `doctrine/cache` dependency has been removed; require it via `composer
117121
require doctrine/cache` if you are using Doctrine cache in your project.
118122

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ CHANGELOG
44
3.4.0
55
-----
66

7+
* Made the `cache:clear` command to *not* clear "app" PSR-6 cache pools anymore,
8+
but to still clear "system" ones; use the `cache:pool:clear` command to clear "app" pools instead
79
* Always register a minimalist logger that writes in `stderr`
810
* Deprecated `profiler.matcher` option
911
* Added support for `EventSubscriberInterface` on `MicroKernelTrait`

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function process(ContainerBuilder $container)
106106

107107
foreach ($clearers as $id => $pools) {
108108
$clearer = $container->getDefinition($id);
109-
if ($clearer instanceof ChilDefinition) {
109+
if ($clearer instanceof ChildDefinition) {
110110
$clearer->replaceArgument(0, $pools);
111111
} else {
112112
$clearer->setArgument(0, $pools);

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,7 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
18021802
if (!$container->getParameter('kernel.debug')) {
18031803
$propertyAccessDefinition->setFactory(array(PropertyAccessor::class, 'createCache'));
18041804
$propertyAccessDefinition->setArguments(array(null, null, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)));
1805-
$propertyAccessDefinition->addTag('cache.pool', array('clearer' => 'cache.default_clearer'));
1805+
$propertyAccessDefinition->addTag('cache.pool', array('clearer' => 'cache.system_clearer'));
18061806
$propertyAccessDefinition->addTag('monolog.logger', array('channel' => 'cache'));
18071807
} else {
18081808
$propertyAccessDefinition->setClass(ArrayAdapter::class);

src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
<service id="cache.adapter.system" class="Symfony\Component\Cache\Adapter\AdapterInterface" abstract="true">
3131
<factory class="Symfony\Component\Cache\Adapter\AbstractAdapter" method="createSystemCache" />
32-
<tag name="cache.pool" clearer="cache.default_clearer" />
32+
<tag name="cache.pool" clearer="cache.system_clearer" />
3333
<tag name="monolog.logger" channel="cache" />
3434
<argument /> <!-- namespace -->
3535
<argument>0</argument> <!-- default lifetime -->
@@ -101,6 +101,10 @@
101101
</service>
102102

103103
<service id="cache.default_clearer" class="Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer">
104+
<argument type="collection" />
105+
</service>
106+
107+
<service id="cache.system_clearer" parent="cache.default_clearer" public="true">
104108
<tag name="kernel.cache_clearer" />
105109
</service>
106110

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
1313

14-
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
14+
use Symfony\Component\Cache\Adapter\AdapterInterface;
1515
use Symfony\Component\Cache\Adapter\RedisAdapter;
1616
use Symfony\Component\Cache\Exception\InvalidArgumentException;
1717

1818
class CachePoolsTest extends WebTestCase
1919
{
2020
public function testCachePools()
2121
{
22-
$this->doTestCachePools(array(), FilesystemAdapter::class);
22+
$this->doTestCachePools(array(), AdapterInterface::class);
2323
}
2424

2525
/**
@@ -67,7 +67,7 @@ public function testRedisCustomCachePools()
6767
}
6868
}
6969

70-
public function doTestCachePools($options, $adapterClass)
70+
private function doTestCachePools($options, $adapterClass)
7171
{
7272
static::bootKernel($options);
7373
$container = static::$kernel->getContainer();

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ framework:
66
pools:
77
cache.pool1:
88
public: true
9+
adapter: cache.system
910
cache.pool2:
1011
public: true
1112
adapter: cache.pool3

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ framework:
1111
pools:
1212
cache.pool1:
1313
public: true
14+
clearer: cache.system_clearer
1415
cache.pool2:
1516
public: true
1617
clearer: ~

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/redis_custom_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ framework:
2222
pools:
2323
cache.pool1:
2424
public: true
25+
clearer: cache.system_clearer
2526
cache.pool2:
2627
public: true
2728
clearer: ~

0 commit comments

Comments
 (0)