10000 [Cache] fix sharing cache between apps · symfony/symfony@f4b9635 · GitHub
[go: up one dir, main page]

Skip to content

Commit f4b9635

Browse files
committed
[Cache] fix sharing cache between apps
The configurable cache prefix seed does not give full control over the cache prefix because the container class is added to the prefix in any case. This is a problem because the container class contains the app env name. We use different app environments for different deployment targets (dev and test). Dev and test should use the same redis cache. But this is impossible to achieve because even setting the cache prefix seed does not accomplish this.
1 parent 7a6e3c0 commit f4b9635

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function testArgsAreReplaced()
8787

8888
$this->assertInstanceOf(Reference::class, $cachePool->getArgument(0));
8989
$this->assertSame('foobar', (string) $cachePool->getArgument(0));
90-
$this->assertSame('tQNhcV-8xa', $cachePool->getArgument(1));
90+
$this->assertSame('croSeNd5bG', $cachePool->getArgument(1));
9191
$this->assertSame(3, $cachePool->getArgument(2));
9292
}
9393

@@ -108,7 +108,7 @@ public function testWithNameAttribute()
108108

109109
$this->cachePoolPass->process($container);
110110

111-
$this->assertSame('+naTpPa4Sm', $cachePool->getArgument(1));
111+
$this->assertSame('-Tv17ISg7e', $cachePool->getArgument(1));
112112
}
113113

114114
public function testThrowsExceptionWhenCachePoolTagHasUnknownAttributes()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,11 +1457,11 @@ public function testCachePoolServices()
14571457
(new ChildDefinition('cache.adapter.array'))
14581458
->replaceArgument(0, 12),
14591459
(new ChildDefinition('cache.adapter.filesystem'))
1460-
->replaceArgument(0, 'xctxZ1lyiH')
1460+
->replaceArgument(0, 'kByObfHfz6')
14611461
->replaceArgument(1, 12),
14621462
(new ChildDefinition('cache.adapter.redis'))
14631463
->replaceArgument(0, new Reference('.cache_connection.kYdiLgf'))
1464-
->replaceArgument(1, 'xctxZ1lyiH')
1464+
->replaceArgument(1, 'kByObfHfz6')
14651465
->replaceArgument(2, 12),
14661466
],
14671467
12,

src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public function process(ContainerBuilder $container)
5252
$seed = '.'.$container->getParameterBag()->resolveValue($container->getParameter('cache.prefix.seed'));
5353
} else {
5454
$seed = '_'.$container->getParameter('kernel.project_dir');
55+
$seed .= '.'.$container->getParameter('kernel.container_class');
5556
}
56-
$seed .= '.'.$container->getParameter('kernel.container_class');
5757

5858
$allPools = [];
5959
$clearers = [];

src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function testArgsAreReplaced()
135135

136136
$this->assertInstanceOf(Reference::class, $cachePool->getArgument(0));
137137
$this->assertSame('foobar', (string) $cachePool->getArgument(0));
138-
$this->assertSame('tQNhcV-8xa', $cachePool->getArgument(1));
138+
$this->assertSame('croSeNd5bG', $cachePool->getArgument(1));
139139
$this->assertSame(3, $cachePool->getArgument(2));
140140
}
141141

@@ -156,7 +156,7 @@ public function testWithNameAttribute()
156156

157157
$this->cachePoolPass->process($container);
158158

159-
$this->assertSame('+naTpPa4Sm', $cachePool->getArgument(1));
159+
$this->assertSame('-Tv17ISg7e', $cachePool->getArgument(1));
160160
}
161161

162162
public function testThrowsExceptionWhenCachePoolTagHasUnknownAttributes()

0 commit comments

Comments
 (0)
0