Repository navigation
is exists anyway to disable cache invalidation in runtime? #2926
Description
Activity
Do you mean to disable the cache tags only for certain operations?
Looking at the code, this is not currently possible.
Do you mean to disable the cache tags only for certain operations?
No, i want to disable cache tags for certain resource or for all resource in certain console commands.
Looking at the code, this is not currently possible.
I check code and didn't saw anything, maybe we have this feature in future?
I don't see the support for disabling cache tags for a certain resource either.
These should be easy to add. PRs welcome!
Hello @teohhanhui
Would love to help on this matter as I'm experiencing the same problem.
First, which developer interface do you have in mind for this feature.
As I see it, I see three options :- an Annotation on a service that would disable the cache invalidation temporarly
/** * @DisableCachePurge */ class MyMassiveImportCommand {- an interface that would implement a enableCachePurge and disableCachePurge method
interface ControlCachePurgeInterface { public function enableCachePurge(); public function disableCachePurge(); }Do you think one of these solutions would be apropriate ?
Thanks !
Hello @teohhanhui
What do you think about the solutions I suggested? Do you have a better idea to fix this?
Thanks!
Hello @teohhanhui
Were you able to have a look at the solution I suggested? Looking forward to have your feedbacks and other ideas!
Thanks!
@oussj Thanks for the suggestions, but I don't think they're the right ones for this case. 😄
If you want to disable cache purging for a certain console command, that should already be possible by using e.g.
api_platform: http_cache: invalidation: enabled: '%env(bool:CACHE_INVALIDATION_ENABLED)%'
$ CACHE_INVALIDATION_ENABLED=0 bin/console app:my:commandOk thanks !
I'm looking into it !hello @teohhanhui
so from what I see what you proposed is already a solution actually to this issue. Moreover the fix proposed by @bastnic in #3168 resolves this issue too. Should you close this issue ?- locked and limited conversation to collaborators
on Nov 6, 2022
Hi, I have some command that do heavy work, but for some reason i don't need to purge cache,
I want to disable cache invalidation for those commands, i removed
PurgeHttpCacheListenerlistener from entityManager.is exists anyway to disable cache invalidation by calling a service method?