File manager - Edit - /usr/share/doc/varnish/html/reference/vmod_purge.html
Back
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>VMOD purge - Varnish Purge Module — Varnish version 7.1.1 documentation</title> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="../_static/classic.css" type="text/css" /> <script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> <script src="../_static/jquery.js"></script> <script src="../_static/underscore.js"></script> <script src="../_static/doctools.js"></script> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="next" title="VMOD std - Varnish Standard Module" href="vmod_std.html" /> <link rel="prev" title="VMOD proxy - Varnish Module to extract TLV attributes from PROXYv2" href="vmod_proxy.html" /> </head><body> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="vmod_std.html" title="VMOD std - Varnish Standard Module" accesskey="N">next</a> |</li> <li class="right" > <a href="vmod_proxy.html" title="VMOD proxy - Varnish Module to extract TLV attributes from PROXYv2" accesskey="P">previous</a> |</li> <li class="nav-item nav-item-0"><a href="../index.html">Varnish version 7.1.1 documentation</a> »</li> <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">The Varnish Reference Manual</a> »</li> <li class="nav-item nav-item-this"><a href="">VMOD purge - Varnish Purge Module</a></li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="vmod-purge-varnish-purge-module"> <span id="vmod-purge-3"></span><h1>VMOD purge - Varnish Purge Module<a class="headerlink" href="#vmod-purge-varnish-purge-module" title="Permalink to this headline">¶</a></h1> <div class="section" id="synopsis"> <h2>SYNOPSIS<a class="headerlink" href="#synopsis" title="Permalink to this headline">¶</a></h2> <pre class="literal-block">import purge [as name] [from "path"] <a class="reference internal" href="#purge-hard"><span class="std std-ref">INT hard()</span></a> <a class="reference internal" href="#purge-soft"><span class="std std-ref">INT soft(DURATION ttl, DURATION grace, DURATION keep)</span></a></pre> </div> <div class="section" id="description"> <h2>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h2> <p><em>vmod_purge</em> contains functions that offer a finer-grained control than <code class="docutils literal notranslate"><span class="pre">return(purge)</span></code> from <code class="docutils literal notranslate"><span class="pre">vcl_recv{}</span></code>. The functions can only be called from <code class="docutils literal notranslate"><span class="pre">vcl_hit{}</span></code> or <code class="docutils literal notranslate"><span class="pre">vcl_miss{}</span></code> and they should in general be used in both to ensure that all variants of a same object are taken care of.</p> </div> <div class="section" id="example"> <h2>EXAMPLE<a class="headerlink" href="#example" title="Permalink to this headline">¶</a></h2> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>sub vcl_recv { if (req.method == "PURGE") { if (client.ip !~ purge_acl) { return (synth(405)); } return (hash); } } sub my_purge { set req.http.purged = purge.hard(); if (req.http.purged == "0") { return (synth(404)); } else { return (synth(200)); } } sub vcl_hit { if (req.method == "PURGE") { call my_purge; } } sub vcl_miss { if (req.method == "PURGE") { call my_purge; } } sub vcl_synth { if (req.method == "PURGE") { if (req.http.purged) { set resp.http.purged = req.http.purged; } return (deliver); } } </pre></div> </div> <div class="section" id="int-hard"> <span id="purge-hard"></span><h3>INT hard()<a class="headerlink" href="#int-hard" title="Permalink to this headline">¶</a></h3> <p>This is equivalent to <code class="docutils literal notranslate"><span class="pre">return(purge)</span></code> but explicitly called from <code class="docutils literal notranslate"><span class="pre">vcl_hit{}</span></code> and <code class="docutils literal notranslate"><span class="pre">vcl_miss{}</span></code>. It returns the number of purged objects.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="nb">set</span> <span class="n">req</span><span class="o">.</span><span class="n">http</span><span class="o">.</span><span class="n">purged</span> <span class="o">=</span> <span class="n">purge</span><span class="o">.</span><span class="n">hard</span><span class="p">();</span> </pre></div> </div> </div> <div class="section" id="int-soft-duration-ttl-duration-grace-duration-keep"> <span id="purge-soft"></span><h3>INT soft(DURATION ttl, DURATION grace, DURATION keep)<a class="headerlink" href="#int-soft-duration-ttl-duration-grace-duration-keep" title="Permalink to this headline">¶</a></h3> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">INT</span> <span class="n">soft</span><span class="p">(</span><span class="n">DURATION</span> <span class="n">ttl</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">DURATION</span> <span class="n">grace</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">DURATION</span> <span class="n">keep</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span> </pre></div> </div> <p>Sets the <em>ttl</em>, <em>grace</em> and <em>keep</em>.</p> <p>By default, <em>ttl</em> is set to 0 with <em>grace</em> and <em>keep</em> periods left untouched. Setting a negative value for <em>grace</em> or <em>keep</em> periods leaves them untouched. Setting all three parameters to <code class="docutils literal notranslate"><span class="pre">0</span></code> is equivalent to a hard purge. It can only be called from <code class="docutils literal notranslate"><span class="pre">vcl_hit{}</span></code> or <code class="docutils literal notranslate"><span class="pre">vcl_miss{}</span></code>. It returns the number of soft-purged objects.</p> </div> </div> <div class="section" id="see-also"> <h2>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</a></h2> <ul class="simple"> <li><p><a class="reference internal" href="vcl.html#vcl-7"><span class="std std-ref">VCL</span></a></p></li> </ul> </div> <div class="section" id="copyright"> <h2>COPYRIGHT<a class="headerlink" href="#copyright" title="Permalink to this headline">¶</a></h2> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>Copyright (c) 2017 Varnish Software AS All rights reserved. Author: Dridi Boukelmoune <dridi.boukelmoune@gmail.com> 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 ``AS IS'' 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. </pre></div> </div> </div> </div> <div class="clearer"></div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h3><a href="../index.html">Table of Contents</a></h3> <ul> <li><a class="reference internal" href="#">VMOD purge - Varnish Purge Module</a></li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="vmod_proxy.html" title="previous chapter">VMOD proxy - Varnish Module to extract TLV attributes from PROXYv2</a></p> <h4>Next topic</h4> <p class="topless"><a href="vmod_std.html" title="next chapter">VMOD std - Varnish Standard Module</a></p> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/reference/vmod_purge.rst.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3 id="searchlabel">Quick search</h3> <div class="searchformwrapper"> <form class="search" action="../search.html" method="get"> <input type="text" name="q" aria-labelledby="searchlabel" /> <input type="submit" value="Go" /> </form> </div> </div> <script>$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="vmod_std.html" title="VMOD std - Varnish Standard Module" >next</a> |</li> <li class="right" > <a href="vmod_proxy.html" title="VMOD proxy - Varnish Module to extract TLV attributes from PROXYv2" >previous</a> |</li> <li class="nav-item nav-item-0"><a href="../index.html">Varnish version 7.1.1 documentation</a> »</li> <li class="nav-item nav-item-1"><a href="index.html" >The Varnish Reference Manual</a> »</li> <li class="nav-item nav-item-this"><a href="">VMOD purge - Varnish Purge Module</a></li> </ul> </div> <div class="footer" role="contentinfo"> © Copyright 2010-2014, Varnish Software AS. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.4.3. </div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.1 |
proxy
|
phpinfo
|
Settings