r1816 - in trunk/varnish-cache: bin/varnishd include lib/libvcl

Poul-Henning Kamp phk at phk.freebsd.dk
Thu Aug 9 21:17:22 CEST 2007

In message <ujr7io4sq1n.fsf at false.linpro.no>, =?iso-8859-1?Q?Dag-Erling_Sm=F8rg
rav?= writes:

>I'm not entirely comfortable with this.  If the goal is to allow
>purging to take the virtual host into account, I believe it would be
>better to implement URL normalization so the host name becomes part of
>the URL.

That was my original plan, however, upon thinking about it, I realized
that it would accomplish less, require more code and run slower.

We have no other need of a normalized URL, so the text-processing would
be solely for the ability to purge, and would in all relevant cases mirror
the necessary text-processing we do on the hash string.

And once you boil it down to the essence, what you want to do with
purge is nuke cached objects.

>From our point of view, objects have only one relevant unique
identity: their hash string.

And once people start to put cookies or languages into their hash
strings, those properties become valid targets for purges as well
("Purge all french documents").

Unless your VCL is really interesting, the obvious command will
	hash.purge mypage.html
	hash.purge foohost.com

The one thing about this scheme I'm not sure about is the use of '#'
as separator.  It's my impression that it occurs infrequently in the
relevant data (url, host, cookies &c) but it bothers me that it is
a commom comment character, but I worked hard to find an alternative.

I kept the purge_url around mostly for backwards compatibility,
because you can do the exact same thing with purge_hash.

The "real" solution, would be to have a
	vcl.purge <vcl_conditional>
and compile the conditional with VCC, so you could say things like:

	vcl.purge "obj.ttl > 1h && obj.http.cookie[FOO]"

But I doubt we'll ever do that...

>That being said, there is no reason to provide backward compat with
>purge() since we never released it - it was added after 1.1.

Ok, I'll yank that then.

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-commit mailing list