Skip to main content

p.a.caching add-on for a better purging policy

Project description


Travis CI badge

collective.purgbyid is a new method for cache invalidation of Plone based web sites. It uses the idea of adding an extra header, called X-Ids-Involved, which contains thee uuids of the objects involved in the construction of the resources. For example, an image contains just its uuid:

% wget -S http://localhost:8080/Plone/image01
  X-Ids-Involved: #c8d7c0bc2b794325b916d990de91d7ee#

Other pages may be more complicated. Then a new purge rewrite rule adds a custom URL to the set of URLs to purge: the “purge by id” custom URL is in the form /@@purgebyid/<UUID> where UUID is the object’s uuid to be purged.

Last, Varnish is configured so that, when an URL /@@purgebyid/<UUID> is purged, it will ban all the objects that match an X-Ids-Involved header of the right type (i.e. containing the uuid of the resource to purge). This means that when a resources is purged, it is enough to purge also it /@@purgebyid/<UUID> URL because it will be Varnish responsibily to also catch all of the occurrencies of the resources whenever the URL which is used to access it.


Config example:

sub vcl_recv {
    if (req.request == "PURGE") {
        if (!client.ip ~ purge) {
            error 405 "Not allowed.";
        if (req.url ~ "^/@@purgebyid/") {
            ban("obj.http.x-ids-involved ~ #" + regsub(req.url, "^/@@purgebyid/", "") + "#");
            error 200 "Ban added";

sub vcl_deliver {
    unset resp.http.x-ids-involved;


Mauro Amico, Author


1.1.1 (2019-06-05)

  • Python 3 support [mamico]

1.1.0 (2018-05-14)

  • moved headers mutator from PubSuccess event to plone.transformchain. fix missing header using p.a.caching’s ramcache operations #2 [mamico]
  • added IIDinvolved adapter for easy implements “involved id” extractors [mamico]
  • manage resourcedirectory, because previously all resources were marked as “involved” by navigation root [mamico]
  • fix issue where IUUID-adaptation did not have default value [datakurre]

1.0.0 (2016-01-14)

  • use zope.annotation on request [mamico]
  • unused generic setup profile removed [mamico]

1.0.0a1 (2013-09-11)

  • Package created using templer [Mauro Amico]

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for collective.purgebyid, version 1.1.1
Filename, size File type Python version Upload date Hashes
Filename, size collective.purgebyid-1.1.1.tar.gz (15.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page