-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Add framework.cache.prefix_seed for predictible cache key prefixes #20610
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
Conversation
@@ -1242,6 +1242,9 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con | |||
$container->getDefinition('cache.adapter.system')->replaceArgument(2, $version); | |||
$container->getDefinition('cache.adapter.filesystem')->replaceArgument(2, $config['directory']); | |||
|
|||
if (isset($config['prefix_seed'])) { | |||
$container->setParameter('cache.prefix.seed', $config['prefix_seed']); |
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.
Why not setting it directly on the pass it self? Yes; foreaching all passes to find any instance of CachePoolPass
.
Otherwise maybe use a less generic name, to clarify something's going on (it's a tmp thingy, only to transfer config..), ie. setParameter(CachePoolPass::class.'_prefix_seed')
.
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.
To achieve which goal?
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.
Guess to avoid creating params into the wild and making things less implicit. Im fine with it though.. just curious :)
This mix&matches framework.cache.prefix_seed
and %cache.prefix.seed%
, they're the same. In apps this often shows a code smell, as people tend to use params as some global config array, by exactly doing this.
Thank you @nicolas-grekas. |
…ictible cache key prefixes (nicolas-grekas) This PR was merged into the 3.2 branch. Discussion ---------- [FrameworkBundle] Add framework.cache.prefix_seed for predictible cache key prefixes | 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 | - 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 ------- 82952bd [FrameworkBundle] Add framework.cache.prefix_seed for predictible cache key prefixes
…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
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.