-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Bridge/Doctrine] Use cache.prefix.seed parameter for generating cache namespace #20616
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
[Bridge/Doctrine] Use cache.prefix.seed parameter for generating cache namespace #20616
Conversation
a5609c7
to
5b47181
Compare
if ($container->hasParameter('cache.prefix.seed')) { | ||
$seed = '.'.$container->getParameterBag()->resolveValue($container->getParameter('cache.prefix.seed')); | ||
} elseif ($container->getParameter('kernel.debug')) { | ||
$seed = '_'.$container->getParameter('kernel.root_dir'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about reintroducing kernel.root_dir
but only when kernel.debug
is true, so that locally running apps have separate cache namespaces by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not convinced that this is a good idea as it will force developers you deploy more than one application to the same server that share the same cache backend to always configure the cache.prefix.seed
option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I updated the code to use cache.prefix.seed
when available, or kernel.root_dir
as fallback. Looks better to me also.
Ping @symfony/deciders , we need to make a decision on this one before the end of the week for 3.2 to be ready (2/3). |
5b47181
to
2ad870d
Compare
👍 |
2575d74
to
3f3733b
Compare
3f3733b
to
5e3cbec
Compare
👍 Status: Reviewed |
…rating cache namespace (nicolas-grekas) This PR was merged into the 3.2 branch. Discussion ---------- [Bridge/Doctrine] Use cache.prefix.seed parameter for generating cache namespace | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Exactly the same issue as in #20610, but for Doctrine ORM's cache: > That's a design issue: using root_dir as discriminant doesn't work with blue/green deployment strategies, and doesn't prevent collision when different apps are deployed in the same path while sharing the same cache backend. Commits ------- 5e3cbec [Bridge/Doctrine] Use cache.prefix.seed parameter for generating cache namespace
Exactly the same issue as in #20610, but for Doctrine ORM's cache: