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

Skip to content

[Cache] fix sharing cache between apps #35723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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 @@ -87,7 +87,7 @@ public function testArgsAreReplaced()

$this->assertInstanceOf(Reference::class, $cachePool->getArgument(0));
$this->assertSame('foobar', (string) $cachePool->getArgument(0));
$this->assertSame('tQNhcV-8xa', $cachePool->getArgument(1));
$this->assertSame('croSeNd5bG', $cachePool->getArgument(1));
$this->assertSame(3, $cachePool->getArgument(2));
}

Expand All @@ -108,7 +108,7 @@ public function testWithNameAttribute()

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

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

public function testThrowsExceptionWhenCachePoolTagHasUnknownAttributes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1457,11 +1457,11 @@ public function testCachePoolServices()
(new ChildDefinition('cache.adapter.array'))
->replaceArgument(0, 12),
(new ChildDefinition('cache.adapter.filesystem'))
->replaceArgument(0, 'xctxZ1lyiH')
->replaceArgument(0, 'kByObfHfz6')
->replaceArgument(1, 12),
(new ChildDefinition('cache.adapter.redis'))
->replaceArgument(0, new Reference('.cache_connection.kYdiLgf'))
->replaceArgument(1, 'xctxZ1lyiH')
->replaceArgument(1, 'kByObfHfz6')
->replaceArgument(2, 12),
],
12,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public function process(ContainerBuilder $container)
$seed = '.'.$container->getParameterBag()->resolveValue($container->getParameter('cache.prefix.seed'));
} else {
$seed = '_'.$container->getParameter('kernel.project_dir');
$seed .= '.'.$container->getParameter('kernel.container_class');
Copy link
Contributor Author

@Tobion Tobion Feb 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think we should set this combined seed as default in

->scalarNode('prefix_seed')
->info('Used to namespace cache keys when using several apps with the same shared backend')
->example('my-application-name')

Then the default behavior is obvious and people understand why they might want to change this value.

}
$seed .= '.'.$container->getParameter('kernel.container_class');

$allPools = [];
$clearers = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function testArgsAreReplaced()

$this->assertInstanceOf(Reference::class, $cachePool->getArgument(0));
$this->assertSame('foobar', (string) $cachePool->getArgument(0));
$this->assertSame('tQNhcV-8xa', $cachePool->getArgument(1));
$this->assertSame('croSeNd5bG', $cachePool->getArgument(1));
$this->assertSame(3, $cachePool->getArgument(2));
}

Expand All @@ -156,7 +156,7 @@ public function testWithNameAttribute()

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

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

public function testThrowsExceptionWhenCachePoolTagHasUnknownAttributes()
Expand Down