.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "VMOD_PURGE" "3" "" "" .SH NAME vmod_purge \- Varnish Purge Module .\" . .\" NB: This file is machine generated, DO NOT EDIT! . .\" . .\" Edit ./vmod_purge.vcc and run make instead . .\" . .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .EX import purge [as name] [from \(dqpath\(dq] INT hard() INT soft(DURATION ttl, DURATION grace, DURATION keep) .EE .UNINDENT .UNINDENT .SH DESCRIPTION .sp \fIvmod_purge\fP contains functions that offer a finer\-grained control than \fBreturn(purge)\fP from \fBvcl_recv{}\fP\&. The functions can only be called from \fBvcl_hit{}\fP or \fBvcl_miss{}\fP and they should in general be used in both to ensure that all variants of a same object are taken care of. .SH EXAMPLE .INDENT 0.0 .INDENT 3.5 .sp .EX sub vcl_recv { if (req.method == \(dqPURGE\(dq) { if (client.ip !~ purge_acl) { return (synth(405)); } return (hash); } } sub my_purge { set req.http.purged = purge.hard(); if (req.http.purged == \(dq0\(dq) { return (synth(404)); } else { return (synth(200)); } } sub vcl_hit { if (req.method == \(dqPURGE\(dq) { call my_purge; } } sub vcl_miss { if (req.method == \(dqPURGE\(dq) { call my_purge; } } sub vcl_synth { if (req.method == \(dqPURGE\(dq) { if (req.http.purged) { set resp.http.purged = req.http.purged; } return (deliver); } } .EE .UNINDENT .UNINDENT .SS INT hard() .sp This is equivalent to \fBreturn(purge)\fP but explicitly called from \fBvcl_hit{}\fP and \fBvcl_miss{}\fP\&. It returns the number of purged objects. .sp Example: .INDENT 0.0 .INDENT 3.5 .sp .EX set req.http.purged = purge.hard(); .EE .UNINDENT .UNINDENT .sp Restricted to: \fBvcl_hit\fP, \fBvcl_miss\fP\&. .SS INT soft(DURATION ttl, DURATION grace, DURATION keep) .INDENT 0.0 .INDENT 3.5 .sp .EX INT soft(DURATION ttl=0, DURATION grace=\-1, DURATION keep=\-1) .EE .UNINDENT .UNINDENT .sp Sets the \fIttl\fP, \fIgrace\fP and \fIkeep\fP\&. By default, \fIttl\fP is set to \fB0\fP with \fIgrace\fP and \fIkeep\fP periods left untouched. Setting \fIgrace\fP or \fIkeep\fP to a negative value or to something higher than the objects current value leaves them untouched. Setting all three parameters to \fB0\fP is equivalent to a hard purge. Returns the number of soft\-purged objects. .sp A soft\-purge can only decrease the lifetime of an object. Let\(aqs consider an object in cache created with \fIttl\fP, \fIgrace\fP, and \fIkeep\fP of 60 seconds each: .sp \fBpurge.soft(ttl = 0s, grace = \-1s, keep = \-1s);\fP .INDENT 0.0 .IP \(bu 2 If the object is \fBfresh\fP, the \fIttl\fP is reduced to 0 seconds and the object expires after 120 seconds. .IP \(bu 2 If the object is \fBstale\fP, the expiry time is not changed. .UNINDENT .sp \fBpurge.soft(ttl = 0s, grace = 10s, keep = 10s);\fP .INDENT 0.0 .IP \(bu 2 If the object is \fBfresh\fP, the \fIttl\fP is reduced to 0 seconds, \fIgrace\fP and \fIkeep\fP are reduced to 10 seconds. The object expires after 20 seconds. .IP \(bu 2 If the object has been \fBstale\fP for 5 seconds, \fIgrace\fP is reduced to 5 seconds and \fIkeep\fP is reduced to 10 seconds. The object expires after 15 seconds. .IP \(bu 2 If the object has been \fBstale\fP for 15 seconds, \fIgrace\fP is reduced to 0 seconds and \fIkeep\fP is reduced to 5 seconds. The object expires after 5 seconds. .IP \(bu 2 If the object has been \fBstale\fP for 20 seconds or more, the object immediately expires. .UNINDENT .sp \fBpurge.soft(ttl = 10s, grace = \-1s, keep = \-1s);\fP .INDENT 0.0 .IP \(bu 2 If the object has been \fBfresh\fP for 5 seconds, the \fIttl\fP is reduced to 10 seconds. The object expires after 130 seconds. .IP \(bu 2 If the object has been \fBfresh\fP for 55 seconds, the \fIttl\fP is not changed. The object expires after 125 seconds. .IP \(bu 2 If the object is \fBstale\fP, the expiry time is not changed. .UNINDENT .sp When the expiry time of an object is reduced due to a softpurge, an \fBEXP_Reduce\fP entry is logged under the \fBExpKill\fP VSL tag. If a softpurge does not reduce the expiry time of an object, an \fBEXP_Unchanged\fP entry is logged instead. .sp Restricted to: \fBvcl_hit\fP, \fBvcl_miss\fP\&. .SH SEE ALSO .INDENT 0.0 .IP \(bu 2 \fIvcl(7)\fP .UNINDENT .SH COPYRIGHT .INDENT 0.0 .INDENT 3.5 .sp .EX Copyright (c) 2017 Varnish Software AS All rights reserved. Author: Dridi Boukelmoune SPDX\-License\-Identifier: BSD\-2\-Clause Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \(ga\(gaAS IS\(aq\(aq AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .EE .UNINDENT .UNINDENT .\" Generated by docutils manpage writer. .