Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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']) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

$container->loadFromExtension('framework', [
'cache' => [
'app' => 'cache.adapter.redis_tag_aware',
],
]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

$container->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',
],
],
],
]);
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<framework:cache>
<framework:app>cache.adapter.redis_tag_aware</framework:app>
</framework:cache>
</framework:config>
</container>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<framework:cache>
<framework:app>cache.redis_tag_aware.bar</framework:app>
<framework:pool name="cache.redis_tag_aware.foo" adapter="cache.adapter.redis_tag_aware" />
<framework:pool name="cache.redis_tag_aware.bar" adapter="cache.redis_tag_aware.foo" />
</framework:cache>
</framework:config>
</container>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
framework:
cache:
app: cache.adapter.redis_tag_aware
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down