-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Cache] Add cache pool get & set command #37880
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
[Cache] Add cache pool get & set command #37880
Conversation
8ae67b2
to
850d918
Compare
src/Symfony/Bundle/FrameworkBundle/Command/CachePoolGetSetCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Command/CachePoolGetSetCommand.php
Outdated
Show resolved
Hide resolved
850d918
to
b6ec9db
Compare
I like this feature 👍! However, to me, it's better to spit this command into two: About the output, I'm not convinced of the big green block. I prefer to have a small text like with messages of the second version in blue or green and have the dumped value before with a blank line.
|
I agree the cache key should just be a |
4b45ddf
to
d9ab7a3
Compare
@YaFou @ogizanagi defined 2 separate commands instead @ogizanagi i do not understand the |
If we have to distinct $ bin/console cache:pool:get cache.app key1 key2 key3
key1
----
(Dumped value)
key2
----
(Dumped value)
key3
----
(Dumped value)
My preference would go for simply outputting the result (or use sections (like above example) if we have a |
d9ab7a3
to
5f7086c
Compare
src/Symfony/Bundle/FrameworkBundle/Resources/config/console.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Resources/config/console.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Command/CachePoolSetCommand.php
Outdated
Show resolved
Hide resolved
5f7086c
to
607cb55
Compare
d215a9d
to
c63abf6
Compare
@ogizanagi thx for the review, all are fixed/improved i also added 2 tests, based on an existing one many thanks tests failure are unrelated:
|
c63abf6
to
2fd2df9
Compare
I indeed think we should not rely on redis for these test cases. Btw, to me, this command can be shipped in the Cache component instead of the FrameworkBundle, so anyone using the component standalone could register these commands on their own.
those are fixed on master, you can rebase. |
src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php
Outdated
Show resolved
Hide resolved
2fd2df9
to
900368b
Compare
@ogizanagi I moved the commands inside the Cache component @nicolas-grekas when testing with
so it is not useful here, I've done like the Todo: if ok, add tests as commented above |
26d0f29
to
3c64ad7
Compare
That's a bit more complex, otherwise the cache pool clearer wouldn't be able to do its job. I suppose it gets a service locator injected + the list of pool it contains. Then it can do it's job. We should be able to borrow this.
This won't work, because pools are private services, isn't it? |
@nicolas-grekas services also inside the
thx |
yes but all the other pools are not public and are perfectly legit to be used here, especially all the ones specified in the user config (I agree for system pools, they're not really intended for this command.
yes, but that's just a fallback when BTW, I just noticed that all the other cache:pool command are in FrameworkBundle. The new ones should be there too IMHO. |
@nicolas-grekas ok i will revert the file move |
30ca324
to
638b0f3
Compare
638b0f3
to
a0e159f
Compare
Do we really want these 2 commands in core? I'm asking the question as we are trying to not clutter the list of default commands and these new commands seem to cover a very edge case (which can easily be done via a custom command if needed). |
@fabpot thank you for your pov here
unsure if the question is for me and/or others reviewers :) seeing the reactions on the PR makes me think it can be usefull inside core cheers! |
Thanks for the PR @noniagriconomie. I'm closing as I agree with @fabpot. Your use case can be implemented with a simple command in your app. I'm also closing because the implementation works only with public pools. Not supporting private ones will create confusion (and supporting private pools is some work that doesn't look worth it compared to @fabpot's comment.) |
@nicolas-grekas understood no problem, just wanted to give a try on the related issue :) thanks anyway :) |
Hi, I originally open the feature request, but I don't really understand why you don't give it a chance. Anyway, thanks for your try @noniagriconomie and for the time used to review |
cache pools are services, and services can be public or private. I'm referring to this concept.
dunno, someone should give it a try. But @fabpot's objection will remain. We could deprecate |
A fast try of the related issue
Commands outputs
Thank you