purge.hash in trunk

Poul-Henning Kamp phk at phk.freebsd.dk
Mon Jul 14 23:58:05 CEST 2008


In message <60AFD34C-2AD1-40CF-AA2A-C4D3DA10E63B at F4.ca>, Skye Poier Nott writes
:

>Oh I see, right, it matches against the whole concatenated hash string.

Yes.

>Why is it that this purges all files from w0011.example.com
>
>	purge.hash w0011.*#.*

Because the last ".*" matches nothing, and you havn't tied it to the
front of the hash string with a "^"

>But this does nothing?
>
>	purge.hash w0011.*#.*#

Because the default vcl_hash says:

    sub vcl_hash {
        set req.hash += req.url;
        if (req.http.host) {
            set req.hash += req.http.host;
        } else {
            set req.hash += server.ip;
        }
        hash;
    }

You are trying to purge all urls that match "w0011"

>Flipping the #'s around works:
>
>	purge.hash #w0011.*#.*

Yes, because now you match the '#' after the url, the hosts that
are named w0011, the '#' after the hostname and nothing with 
the .* at the end.

The correct way to purge everything from w0011 would be:

	purge.hash #w0011.*#

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-misc mailing list