Sends purge request to Varnish cache upon entry submission/deletion
Pull request Compare This branch is 32 commits behind kevincupp:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Purge is an extension for ExpressionEngine 2 that sends a purge request to the Varnish cache upon entry submission/deletion. There is also an accessory option to manually send the request.


I'd set the TTL of the objects in my Varnish cache to like a week if I could. The only problem is when I or the client needs to update the site, the changes are preferred to show up immediately. So I needed a way to automatically purge the cache whenever an entry is submitted, edited or deleted. And then Purge was born.


Add the "purge" folder inside your system/expressionengine/third_party directory, and then install the extension and accessory.

Prepare Varnish

Purge assumes your Varnish cache is accessible at $_SERVER['HTTP_HOST'] through port 80. To change these settings, edit purge/helpers/varnish_helper.php (this may be added to a Settings screen in a later update). Purge will send an EE_PURGE request to Varnish. To get Varnish reacting to this request, add this to your VCL file in vcl_recv:

if (req.request == "EE_PURGE") {
    purge(" ~ && req.url ~ ^/.*$");
    error 200 "Purged";

The above example assumes you want to purge everything under the domain. For more examples on how to purge specific objects, see this nice blog post.

For now, Purge cannot decide which parts of a site need updating and which can stay the same, nor will it probably ever unless EE provides this data. So for now, it's best to purge the entire site.