diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index ac05cf1ad4c39..556232c88e26f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -2153,7 +2153,9 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
$pool['reset'] = 'reset';
}
- if ($isRedisTagAware) {
+ if ($isRedisTagAware && 'cache.app' === $name) {
+ $container->setAlias('cache.app.taggable', $name);
+ } elseif ($isRedisTagAware) {
$tagAwareId = $name;
$container->setAlias('.'.$name.'.inner', $name);
} elseif ($pool['tags']) {
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/cache_app_redis_tag_aware.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/cache_app_redis_tag_aware.php
new file mode 100644
index 0000000000000..44855c62adbf1
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/cache_app_redis_tag_aware.php
@@ -0,0 +1,7 @@
+loadFromExtension('framework', [
+ 'cache' => [
+ 'app' => 'cache.adapter.redis_tag_aware',
+ ],
+]);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/cache_app_redis_tag_aware_pool.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/cache_app_redis_tag_aware_pool.php
new file mode 100644
index 0000000000000..89beceb5748a4
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/cache_app_redis_tag_aware_pool.php
@@ -0,0 +1,15 @@
+loadFromExtension('framework', [
+ 'cache' => [
+ 'app' => 'cache.redis_tag_aware.bar',
+ 'pools' => [
+ 'cache.redis_tag_aware.foo' => [
+ 'adapter' => 'cache.adapter.redis_tag_aware',
+ ],
+ 'cache.redis_tag_aware.bar' => [
+ 'adapter' => 'cache.redis_tag_aware.foo',
+ ],
+ ],
+ ],
+]);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/cache_app_redis_tag_aware.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/cache_app_redis_tag_aware.xml
new file mode 100644
index 0000000000000..2929e87e200e8
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/cache_app_redis_tag_aware.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+ cache.adapter.redis_tag_aware
+
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/cache_app_redis_tag_aware_pool.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/cache_app_redis_tag_aware_pool.xml
new file mode 100644
index 0000000000000..063e51810ef07
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/cache_app_redis_tag_aware_pool.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+ cache.redis_tag_aware.bar
+
+
+
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/cache_app_redis_tag_aware.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/cache_app_redis_tag_aware.yml
new file mode 100644
index 0000000000000..b1c89adafa0ca
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/cache_app_redis_tag_aware.yml
@@ -0,0 +1,3 @@
+framework:
+ cache:
+ app: cache.adapter.redis_tag_aware
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/cache_app_redis_tag_aware_pool.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/cache_app_redis_tag_aware_pool.yml
new file mode 100644
index 0000000000000..042ffd01392e2
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/cache_app_redis_tag_aware_pool.yml
@@ -0,0 +1,8 @@
+framework:
+ cache:
+ app: cache.redis_tag_aware.bar
+ pools:
+ cache.redis_tag_aware.foo:
+ adapter: cache.adapter.redis_tag_aware
+ cache.redis_tag_aware.bar:
+ adapter: cache.redis_tag_aware.foo
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
index e6135d93ca320..4542e7d9d762f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -1587,6 +1587,32 @@ public function testRedisTagAwareAdapter()
}
}
+ /**
+ * @dataProvider testAppRedisTagAwareConfigProvider
+ */
+ public function testAppRedisTagAwareAdapter()
+ {
+ $container = $this->createContainerFromFile('cache_app_redis_tag_aware');
+
+ foreach ([TagAwareCacheInterface::class, CacheInterface::class, CacheItemPoolInterface::class] as $alias) {
+ $def = $container->findDefinition($alias);
+
+ while ($def instanceof ChildDefinition) {
+ $def = $container->getDefinition($def->getParent());
+ }
+
+ $this->assertSame(RedisTagAwareAdapter::class, $def->getClass());
+ }
+ }
+
+ public function testAppRedisTagAwareConfigProvider(): array
+ {
+ return [
+ ['cache_app_redis_tag_aware'],
+ ['cache_app_redis_tag_aware_pool'],
+ ];
+ }
+
public function testRemovesResourceCheckerConfigCacheFactoryArgumentOnlyIfNoDebug()
{
$container = $this->createContainer(['kernel.debug' => true]);