]> err.no Git - varnish/commitdiff
Add an example based on VG's PURGE code.
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 10 Oct 2006 13:36:11 +0000 (13:36 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 10 Oct 2006 13:36:11 +0000 (13:36 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1149 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/man/vcl.7

index eb1d5d85be959ab12e381c70f716b51613065022..88a46ad7244d1fbf07ae07281de23dc7942c1ed1 100644 (file)
@@ -34,8 +34,6 @@
 .Sh NAME
 .Nm VCL
 .Nd Varnish Configuration Language
-.Sh SYNOPSIS
-.\" ...
 .Sh DESCRIPTION
 The
 .Nm
@@ -278,6 +276,37 @@ sub vcl_fetch {
     }
 }
 .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