-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Add cache adapters in semantic configuration #18625
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
</service> | ||
|
||
<service id="cache.pool.local" parent="cache.adapter.local"> | ||
<service id="cache.pool.app" parent="cache.adapter.shared"> |
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.
@javiereguiluz WDYT about this one? We'd like to provide a preconfigured cache pool for user's need, so that one can inject it without much configuration. Currently we have two of these (cache.pool.local
and cache.pool.shared
).
The proposal here is to remove cache.pool.local
and rename cache.pool.shared
to cache.pool.app
.
Which means we have to questions:
- OK for removing the local pool and keep only the shared one?
- is the
cache.pool.app
name OK or do we have a better idea (e.g. iscache.pool.user
better)?
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.
At first glance, maybe this should be called cache.pool.default
I don't like the .app
suffix because all the pools are for the app and because the app.
convention is commonly used as a prefix for user's stuff.
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.
But the pool we're talking about is only for user's stuff :)
👍 with a few more tests, must be on 3.1 or will be much harder to change afterwards. |
We need to update the XML schema definition. |
55bfda8
to
dcbffa2
Compare
@@ -58,5 +39,20 @@ | ||
<argument /> <!-- default lifetime --> | ||
</service> | ||
|
||
<service id="cache.adapter.shared" alias="cache.adapter.filesystem" /> |
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 put the adapters here to follow the reading order (as in the configuration, the extension, etc.)
00986d1
to
959bf64
Compare
…caches (tgalopin, nicolas-grekas) This PR was merged into the 3.1-dev branch. Discussion ---------- [FrameworkBundle] Semantic config for app/system/pool caches | Q | A | ------------- | --- | Branch? | 3.1 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #18625 | License | MIT | Doc PR | - Commits ------- a2a567d [FrameworkBundle] Simplify config for app/system/pool caches 80a5508 [FrameworkBundle] Add cache adapters in semantic configuration
Following other PRs about the integration of the Cache component into the FrameworkBundle, this PR proposes the possibility to define and overide adapters from the semantic configuration.
There are three main reasons why I think we should be able to configure adapters from the
config_*.yml
files:Here is an example of how we could configure every shared cache of the application to use redis instead of the filesystem with this proposal:
By default, the FrameworkBundle defines some useful adapters and pools. Using this proposal configuration, we can represent these adapters and pools like these:
And every adapter could be overriden by using the key
parent
or by using the same name as the parent adapter (if you redefine theredis
adapter to use a different provider, it will override the parent definition).This PR also removes the
local
andshared
pool for a singleapp
pool. This is done to avoid confusion for users between the local/shared adapters and the local/shared pools and because app cache will almost always be shared.