cache empties itself?
Sascha Ottolski
ottolski at web.de
Fri Apr 4 09:13:42 CEST 2008
Am Freitag 04 April 2008 04:37:44 schrieb Ricardo Newbery:
> sub vcl_fetch {
> if (obj.ttl < 120s) {
> set obj.ttl = 120s;
> }
> }
>
> Or you can invent your own header... let's call it X-Varnish-1day
>
> sub vcl_fetch {
> if (obj.http.X-Varnish-1day) {
> set obj.ttl = 86400s;
> }
> }
so it seems like I'm on the right track, thanks for clarifying. now, is
the ttl a information local to varnish, or will it set headers also (if
I look into the headers of my varnishs' responses, it doesn't appear
so)?
what really confuses me: the man pages state a little different
semantics for default_ttl. in man varnishd:
-t ttl Specifies a hard minimum time to live for cached
documents. This is a shortcut for specifying the
default_ttl run-time parameter.
default_ttl
The default time-to-live assigned to objects if neither
the backend nor the configuration assign one. Note
that changes to this parameter are not applied retroac‐
tively.
The default is 120 seconds.
"hard minimum" sounds to me as if it would overwrite any setting the
backend has given. however, in man vcl it's explained, that default_ttl
does only affect documents without backend given TTL:
The following snippet demonstrates how to force a minimum TTL
for all documents. Note that this is not the same as setting
the default_ttl run-time parameter, as that only affects doc‐
ument for which the backend did not specify a TTL.
sub vcl_fetch {
if (obj.ttl < 120s) {
set obj.ttl = 120s;
}
}
the examples have a unit (s) appended, as in the example of the man
page, that suggests that I could also append things like m, h, d (for
minutes, hours, days)?
BTW, in the trunk version, the examples for a backend definition have
still the old syntax.
backend www {
set backend.host = "www.example.com";
set backend.port = "80";
}
instead
backend www {
.host = "www.example.com";
.port = "80";
}
Thanks a lot,
Sascha
More information about the varnish-misc
mailing list