-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Notify event when clearing cache #1884
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
Comments
so the purpose would be that app/console cache:clear would allow plugging in additional services that would be triggered via some event? |
+1 to that |
@lsmith77, yes, like cache warming. |
The console component has no dependency on the event listener and I don't want to add it. You can however extends the built-in |
you could make the cache clear console command notify event dispatcher manually as that is all part of the framework, and not introduce dependency in the component itself, no? |
why not go in a similar direction as cache warmers .. just add cache_clearer services that are registered via a tag. |
+1 for |
ok, reopening this issue as @lsmith77 suggestion is a good idea. |
btw .. my first reply was because I thought you had closed #1929 |
I've experimented with APC a bit today. Am I right, that APC can't be cleared from cli? APC has cli mode disabled by default, but even if I've enabled it, I was not able to access the cache items created from web interface. So if am I right, the APC clearing command (or notify event) should call some URL which will clear APC from web interface. |
Commits ------- 3ae976c fixed CS 84ad40d added cache clear hook Discussion ---------- [Cache][2.1] Added cache clear hook Allows bundles to hook into the `cache:clear` command by using the `kernel.cache_clearer` tag instead of using the `event_dispatcher` service. See #1884 Bug fix: No Feature addition: Yes Backwards compatibility break: No Symfony2 tests pass: Yes Fixes the following tickets: #1884 References the following tickets: #1884 --------------------------------------------------------------------------- by dustin10 at 2011/12/16 11:03:54 -0800 Rebased to squash all commits into one. --------------------------------------------------------------------------- by lsmith77 at 2011/12/17 05:27:29 -0800 @fabpot: we figured that priorities wouldn't be needed for cleaning .. haven't tested the PR, but conceptually it looks good to me and aside from the priority stuff its modeled after the cache warners. --------------------------------------------------------------------------- by dustin10 at 2011/12/19 09:46:26 -0800 @fabpot Updated to pass cache dir to `clear` method. --------------------------------------------------------------------------- by dustin10 at 2011/12/19 10:02:21 -0800 @stof and @fabpot Another thought I just had. Should the `$this->getContainer()->get('cache_clearer')->clear($realCacheDir);` call in the `CacheClearCommand` be done before the warming? --------------------------------------------------------------------------- by stof at 2011/12/19 10:03:59 -0800 indeed. the clearing should be done before the warming. --------------------------------------------------------------------------- by dustin10 at 2011/12/19 10:19:28 -0800 Squashed all commits into one. Let me know if there is anything else. --------------------------------------------------------------------------- by dustin10 at 2011/12/19 10:31:50 -0800 Fixed extra lines.
so it done |
This PR was merged into the master branch. Discussion ---------- Console dispatcher | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #3889, #6124 | License | MIT | Doc PR | symfony/symfony-docs#2352 refs #1884, #1929 This is an alternative implementation for adding events to console applications. This implementation has the following features: * Available for anyone using the Console component and it is not tied to FrameworkBundle (this is important as one thing we are trying to solve is email sending from a command, and frameworks like Silex using the Console component needs a solution too); * Non-intrusive as the current code has not been changed (except for renaming an internal variable that was wrongly named -- so that's not strictly needed for this PR) * The new DispatchableApplication class also works without a dispatcher, falling back to the regular behavior. That makes easy to create applications that can benefit from a dispatcher when available, but can still work otherwise. * Besides the *before* and *after* events, there is also an *exception* event that is dispatched whenever an exception is thrown. * Each event is quite powerful and can manipulate the input, the output, but also the command to be executed. Commits ------- 4f9a55a refactored the implementation of how a console application can handle events 4edf29d added helperSet to console event objects f224102 Added events for CLI commands
Sometimes we need clear additional data, for example APC user-cache. I think better create listeners for clearing additional cache instead of commands like
apc:clear
The text was updated successfully, but these errors were encountered: