Varnish Cache Plus



xkey is an implementation of surrogate cache keys for Varnish.

It operates through having the backend web server tag resources with one or more identifiers, which is then organized for very speedy invalidation inside Varnish.

This allows for invalidating content from the cache using the fast purge method, at request rates of tens of thousands per second.

Further information can be found on:

In Varnish 4.1 this module has been open sourced and renamed to xkey.

VCL example

xkey is implemented as a set of Varnish core extensions which is used by a proprietary Varnish module (VMOD).

VCL code:

import xkey;
sub vcl_recv {
	if (req.http.x-xkey-purge) {
		if (xkey.purge(req.http.x-xkey-purge) != 0) {
			return(synth(200, "Purged"));
		} else {
			return(synth(404, "Key not found"));


xkey is available starting from version 4.1. Before it, it was available as vmod_hashtwo as soon as 3.0.5r1.


The xkey VMOD is prebuilt for supported versions and can be installed using regular package managers from Varnish Software repositories.

The package contains further installation and usage instructions.

Contact if you need assistance.