Needs review
Project:
Purge
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Oct 2011 at 19:41 UTC
Updated:
4 Mar 2016 at 02:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
djbobbydrake commentedI had to update my varnish default.vcl file to include the following:
Comment #2
djbobbydrake commentedActually, my suggestion is kind of dangerous... there would definitely be unintended cache flushes...
Comment #3
SqyD commentedI have to confess I kinda saw this one (and #1304812: Expire all pages likewise ) coming ;-) I've known all along it's very well possible to implement this kind of stuff as Tollef from Varnish taught me himself. When implementing views/panels/etc stuff in the future in expire this may be a viable option when implemented smart enough on the other side of that hook.
The same notion of it being kinda dangerous in most of my personal use cases held me back from implementing it so far. It's one of my objections to the existing Varnish module for Drupal that does implement this kind of features and why I like the Cache Expiration module approach. Will need to have have good permissions and some sensible limiting to the number of requests and wildcards and or course proper default configuration:
flush all caches = 0 DANGER!! Setting this option will seriously harm our natural environment and kill bunnies!
... or leave it hidden outside the gui for us to abuse and/or be heroic when disaster hits ;-)
Comment #4
SqyD commentedComment #5
elijah lynnComment #6
elijah lynnHere is a patch that implements a wildcard purge at the API level for this module. By API level I mean that we are using this module just for the purge_urls() function and passing it an array of URLs directly. In the URL we pass we have a * at the end. This patch turns it into a .* which is a regex that the Varnish 'ban' function needs. This needs a corresponding change in the VCL file, we used the below for ours:
This patch in particular depends on this https://www.drupal.org/node/2680793#comment-10930819 patch because we also escape all the parts of the URL that might be considered regex.
Sorry, this is a bit complicated right now but I figured I would at least post it.
Comment #7
elijah lynnAdded better comment to link back here for corresponding VCL change.