Mailing List Archive

r1149 - trunk/varnish-cache/man
Author: des
Date: 2006-10-10 15:36:11 +0200 (Tue, 10 Oct 2006)
New Revision: 1149

Modified:
trunk/varnish-cache/man/vcl.7
Log:
Add an example based on VG's PURGE code.

Modified: trunk/varnish-cache/man/vcl.7
===================================================================
--- trunk/varnish-cache/man/vcl.7 2006-10-10 13:01:42 UTC (rev 1148)
+++ trunk/varnish-cache/man/vcl.7 2006-10-10 13:36:11 UTC (rev 1149)
@@ -34,8 +34,6 @@
.Sh NAME
.Nm VCL
.Nd Varnish Configuration Language
-.Sh SYNOPSIS
-.\" ...
.Sh DESCRIPTION
The
.Nm
@@ -278,6 +276,37 @@
}
}
.Ed
+.Pp
+The following code implements the HTTP PURGE method as used by Squid
+for object invalidation:
+.Bd -literal -offset 4n
+acl purge {
+ "localhost";
+ "10.0.0.1"/8;
+}
+
+sub vcl_recv {
+ if (req.request == "PURGE") {
+ if (!client.ip ~ purge) {
+ error 405 "Not allowed.";
+ }
+ lookup;
+ }
+}
+
+sub vcl_hit {
+ if (req.request == "PURGE") {
+ set obj.ttl = 0s;
+ error 200 "Purged.";
+ }
+}
+
+sub vcl_miss {
+ if (req.request == "PURGE") {
+ error 404 "Not in cache.";
+ }
+}
+.Ed
.Sh SEE ALSO
.Xr varnishd 1
.Sh HISTORY