From: des Date: Tue, 10 Oct 2006 13:36:11 +0000 (+0000) Subject: Add an example based on VG's PURGE code. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7b31e7783f1ee3af7fcd6c73b5af97674249b70;p=varnish Add an example based on VG's PURGE code. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1149 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/man/vcl.7 b/varnish-cache/man/vcl.7 index eb1d5d85..88a46ad7 100644 --- a/varnish-cache/man/vcl.7 +++ b/varnish-cache/man/vcl.7 @@ -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