Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
'drush cc render' add tag 'rendered' to purge_queue
but 'drush cr' do nothing
I think 'drush cr' must purge everything, 'Clear all caches' button must purge everything too
Comment | File | Size | Author |
---|---|---|---|
#4 | purge_cache_on_drush_cr-2806585-4.patch | 2.82 KB | lhangea |
#3 | purge_cache_on_drush_cr-2806585-3.patch | 1.22 KB | lhangea |
Comments
Comment #2
Wim LeersComment #3
lhangea CreditAttribution: lhangea commentedHere is an initial version of a patch for this issue.
Basically this patch hooks into cache rebuilding (triggered either from admin performance page or from drush) and invalidates all the cache tags invalidated by drupal core.
Note that there is still work to be done here because we need to pass a purge processor for the
invalidate
method of'purge.purgers'
(which by the way, doesn't use that processor at all in it's body) but by defaultcron
,lateruntime
orpurge ui block processor
are not enabled.So anyway, TODO: decide which processor to use in purge_rebuild() or propose another solution :)
Comment #4
lhangea CreditAttribution: lhangea commentedAfter analysing the structure of the module a bit I think the best idea would be to create another submodule which when enabled will invalidate external caches on 'cache clear all' operations - this approach is consistent with how block, cron or late runtime processors are implemented.
So here is the patch doing that.
Comment #5
MiSc CreditAttribution: MiSc at Wunder commentedI don't think it should be a separate module, cache rebuild should purge everything by default, for me it is the expected behaviour. That is my five cents.
Comment #6
lhangea CreditAttribution: lhangea commentedThat works also. For that we will need to provide a plugin processor in the purge module because we need to pass a processor to the
invalidate
method or allow the invalidate method to work without a processor.Comment #7
adam.weingarten CreditAttribution: adam.weingarten as a volunteer commentedPurging external cache on a drush CR is new behavior that we should be VERY careful and fearful about. If I do a CR I would not expect that it would lower all my external caching shields. If this happened during a high-traffic event it could very easily result in web-servers getting overwhelmed by external traffic. If this is going to be added it should be opt-in.
Comment #8
MiSc CreditAttribution: MiSc at Wunder commentedOpt-out, if you ask me, because - what do you expect the default behavior to be? Clear all caches, for me sounds like, yeah clear all caches, not just drupal internal caches.
Comment #9
joshi.rohit100What about adding an optional argument something like
drush cr --reversproxy
for external purging ?Comment #10
MiSc CreditAttribution: MiSc at Wunder commentedLike a side above, I think that then should be something like `drush cr --no-reversproxy-clear`
Comment #11
joshi.rohit100yes agree @MiSc. Anything that separates reverse proxy clear :)
Comment #12
lhangea CreditAttribution: lhangea commentedwhat about the 'cache clear all' from the back-office performance page ?
Comment #13
nielsvm CreditAttribution: nielsvm as a volunteer and at Acquia commentedI'm VERY reluctant about this folks, not because it isn't expected behavior of the CR command (in fact, it is) but simply because of real-world usage of this. People are already taking down sites right now here at Acquia by using CR without understanding its consequences, if people also take out their last line of defense (the external caches), then these self-inflicted downtimes will simply increase drastically. Really, people are assuming "drush cr" to be the natural successor to "drush cc all" without reading.
No, "educating people" is not a full argument against this, reality is a thing to consider too.
I'm not against the opt-in behavior of this kind of feature, but the opt-out case deserves much further debate including folks against before we can decide how to continue.
Comment #14
nielsvm CreditAttribution: nielsvm as a volunteer and at Acquia commentedHow about a second command
drush cre
/drush cache-rebuild-external
? I think the upside of that is that its quite explicit and "in your face" and lets the user think twice about why he's calling a second command next to just CR.Comment #15
adam.weingarten CreditAttribution: adam.weingarten as a volunteer commentedNiels, LOVE that idea. It accomplishes the external clearing in a safe expected way. You know exactly when you are clearing the external caches.
Comment #16
MiSc CreditAttribution: MiSc at Wunder commentedOk, I am convinced :-)
drush cache-rebuild-external
sounds like a good idea, and opt-in as option for the ui.Comment #17
lhangea CreditAttribution: lhangea commentedare you thinking to some kind of BO config or a separate sub-module ?
Comment #18
bkosborneI agree with the sentiment that `drush cr`, as well as the "clear all caches" button on the performance config page should NOT clear external caches. People are so used to running this command and they can easily take down a site if this is added.
Comment #19
nielsvm CreditAttribution: nielsvm as a volunteer and at Acquia commentedJust wrote, tested and committed this:
Its basically a alias for
drush p-invalidate everything
and in the upcoming version of Drush (9+) it will align below the other of core's cache commands.Comment #21
joseph.olstadMy client is asking me to port this functionality from 7 to 8 (it exists in 7 (see the varnish_vanish sandbox project), but with a 'button' to do what this drush command does. Not exactly easy as pie.
I've spent so far quite a bit of time on this.
hope this works, grabbing code from the purge_drush module... Thanks!
***BEGIN EDIT***
ah, just discovered some helpful api docs in the purge module README, double thanks!***END EDIT***