The attached patch adds support for cache tags (http://drupal.org/project/cachetags), which adds the tags in a custom header that varnish can invalidate against. THis is based on dixon's work here, but uses PURGE instead of the admin socket: http://drupal.org/node/1341322.

Because an extra header needs to be passed in, I added a headers parameter in purge_urls, keyed off the urls in the previous argument.

This patch also removes the dependency on expires. From what I could tell, the only reason it was necessary was for expires_print_r, so I copied a version of that function in.

CommentFileSizeAuthor
purge-cachetags.patch4.41 KBmsonnabaum

Comments

msonnabaum’s picture

Also, to get this to work you'd need something like the following in your vcl:

  if (req.request == "PURGE") {
    if (req.http.X-Cache-Tags) {
      purge("req.http.host == " req.http.host " && obj.http.X-Cache-Tags ~ " req.http.X-Cache-Tags);
      error 200 "Purged.";
    }
    return(lookup);
  }
SqyD’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
SqyD’s picture

Is anyone still interested in getting this into the 2.x branch?
The rewrite I'm doing will make adding this functionality a lot easier. May not make it into make it an initial 2.0 release but still seems interesting to implement.
Expire dependency will be dropped as well for 2.x

SqyD’s picture

Status: Needs review » Postponed (maintainer needs more info)

please respond if there is interest in this and I will (scouts honor) look into this for 2.x

SqyD’s picture

Okay, I bumped into Moshe W. this week and he mentioned Cache tags... That for sure counts as interest from the community so I will try to get this into the 2.x branch at some point in the near future.

SqyD’s picture

Status: Postponed (maintainer needs more info) » Active
vacilando’s picture

Issue summary: View changes

Yes, support for cache tags would indeed be great!

japerry’s picture

Status: Active » Closed (outdated)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.