Monday, March 05, 2012

What a pleasant surprise on a Monday morning to see the Cache expiration module release its alpha1 version, ready for basic use and testing.

Varnish, arguable the most common reverse proxy caching mechanism used with Drupal sites has integration with the Cache expiration module. With this module, it was not possible to selectively expire (purge) urls from Varnish. But now we can (atleast for some most commonly used cases).

Basic testing
Some basic testing gave very good expected results. First your Drupal setup to cache pages for anonymous users at admin/config/development/performance. Then by merely enabling the expire module, and using the default options enabled in its config page (snugged away in admin/config/development/performance/expire), you can see the benefits already:

For e.g:
Assume you have you home page cached by varnish (min cache liftime 5mins). Which means any edit to the homepage in that time will not show up to the anon user, who still sees the cached version. Unless you purge Varnish manually.

Not anymore, with the expire module enabled.

Cache expiration will purge the url of the homepage immediately, because you edited your homepage.

Good stuff already! That is not all. Here is a look at its optional features in the alpha1 release:

Optional features

When a node is expired their nodereferences and parent nodes where it is referenced can be expired.

When a 'promoted to homepage' node has been expired, the homepage can be expired.

Expire the menu(tree) when a node expires

Expire the term pages of those terms tagged to an expired node.

Note: 'expired node' refers to a node (url) that is being purged from Varnish on the event of it being edited.