Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
62846342
Commit
62846342
authored
Mar 20, 2014
by
Per Buer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update purging docs for V4.
parent
afbdcbb8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
23 deletions
+8
-23
purging.rst
doc/sphinx/users-guide/purging.rst
+8
-23
No files found.
doc/sphinx/users-guide/purging.rst
View file @
62846342
...
...
@@ -40,31 +40,16 @@ following VCL in place::
error 405 "Not allowed.";
}
# jump to hit/miss
return (
lookup
);
return (
purge
);
}
}
sub vcl_hit {
if (req.method == "PURGE") {
purge;
error 200 "Purged.";
}
}
sub vcl_miss {
if (req.method == "PURGE") {
purge;
error 200 "Purged.";
}
}
As you can see we have used two new VCL subroutines, vcl_hit and
vcl_miss. When we call lookup Varnish will try to lookup the object in
its cache. It will either hit an object or miss it and so the
corresponding subroutine is called. In vcl_hit the object that is
stored in cache is available and we can set the TTL. The purge in
vcl_miss is necessary to purge all variants in the cases where you hit an
object, but miss a particular variant.
As you can see we have used a new action - return(purge). This ends
execution of vcl_recv and jumps to vcl_hash. This is just like we
handle a regular request. When vcl_hash calls return(lookup) varnish
will purge the object and then call vcl_purge. Here you have the
option of adding any particular actions you want Varnish to take once
it has purge the object.
So for example.com to invalidate their front page they would call out
to Varnish like this::
...
...
@@ -121,7 +106,7 @@ You can also add bans to Varnish via HTTP. Doing so requires a bit of VCL::
# Throw a synthetic page so the
# request won't go to the backend.
error 200 "Ban added"
;
return(synth(200m"Ban added"))
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment