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 4b54aa0

Browse filesBrowse files
committed
alias cache.app.taggable to cache.app if using cache.adapter.redis_tag_aware
1 parent 81c2bfd commit 4b54aa0
Copy full SHA for 4b54aa0

File tree

Expand file treeCollapse file tree

8 files changed

+90
-1
lines changed
Filter options
Expand file treeCollapse file tree

8 files changed

+90
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2153,7 +2153,9 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
21532153
$pool['reset'] = 'reset';
21542154
}
21552155

2156-
if ($isRedisTagAware) {
2156+
if ($isRedisTagAware && 'cache.app' === $name) {
2157+
$container->setAlias('cache.app.taggable', $name);
2158+
} elseif ($isRedisTagAware) {
21572159
$tagAwareId = $name;
21582160
$container->setAlias('.'.$name.'.inner', $name);
21592161
} elseif ($pool['tags']) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'cache' => [
5+
'app' => 'cache.adapter.redis_tag_aware',
6+
],
7+
]);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'cache' => [
5+
'app' => 'cache.redis_tag_aware.bar',
6+
'pools' => [
7+
'cache.redis_tag_aware.foo' => [
8+
'adapter' => 'cache.adapter.redis_tag_aware',
9+
],
10+
'cache.redis_tag_aware.bar' => [
11+
'adapter' => 'cache.redis_tag_aware.foo',
12+
],
13+
],
14+
],
15+
]);
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:cache>
10+
<framework:app>cache.adapter.redis_tag_aware</framework:app>
11+
</framework:cache>
12+
</framework:config>
13+
</container>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:cache>
10+
<framework:app>cache.redis_tag_aware.bar</framework:app>
11+
<framework:pool name="cache.redis_tag_aware.foo" adapter="cache.adapter.redis_tag_aware" />
12+
<framework:pool name="cache.redis_tag_aware.bar" adapter="cache.redis_tag_aware.foo" />
13+
</framework:cache>
14+
</framework:config>
15+
</container>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
framework:
2+
cache:
3+
app: cache.adapter.redis_tag_aware
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
framework:
2+
cache:
3+
app: cache.redis_tag_aware.bar
4+
pools:
5+
cache.redis_tag_aware.foo:
6+
adapter: cache.adapter.redis_tag_aware
7+
cache.redis_tag_aware.bar:
8+
adapter: cache.redis_tag_aware.foo

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,6 +1587,32 @@ public function testRedisTagAwareAdapter()
15871587
}
15881588
}
15891589

1590+
/**
1591+
* @dataProvider testAppRedisTagAwareConfigProvider
1592+
*/
1593+
public function testAppRedisTagAwareAdapter()
1594+
{
1595+
$container = $this->createContainerFromFile('cache_app_redis_tag_aware');
1596+
1597+
foreach ([TagAwareCacheInterface::class, CacheInterface::class, CacheItemPoolInterface::class] as $alias) {
1598+
$def = $container->findDefinition($alias);
1599+
1600+
while ($def instanceof ChildDefinition) {
1601+
$def = $container->getDefinition($def->getParent());
1602+
}
1603+
1604+
$this->assertSame(RedisTagAwareAdapter::class, $def->getClass());
1605+
}
1606+
}
1607+
1608+
public function testAppRedisTagAwareConfigProvider(): array
1609+
{
1610+
return [
1611+
['cache_app_redis_tag_aware'],
1612+
['cache_app_redis_tag_aware_pool'],
1613+
];
1614+
}
1615+
15901616
public function testRemovesResourceCheckerConfigCacheFactoryArgumentOnlyIfNoDebug()
15911617
{
15921618
$container = $this->createContainer(['kernel.debug' => true]);

0 commit comments

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