Varnish Cache - default TTL?
This is in the default template:
sub vcl_fetch {
if (beresp.ttl <= 0s ||
beresp.http.Set-Cookie ||
beresp.http.Vary == "*") {
/*
* Mark as "Hit-For-Pass" for the next 2 minutes
*/
set beresp.ttl = 120 s;
return (hit_for_pass);
}
return (deliver);
}
So, 120 seconds.
Default TTL can be passed through the varnishd command via the -t
commandline switch and is probably sourced from a properties file on your filesystem. On the CentOS system I'm looking at it is set using DEFAULT_TTL
from /etc/sysconfig/varnish
.
You can see the live setting using varnishadm like so,
varnishadm param.show default_ttl
Actually, following default VCL logic relates to non-cacheable objects.
sub vcl_fetch {
if (beresp.ttl <= 0s ||
beresp.http.Set-Cookie ||
beresp.http.Vary == "*") {
/*
* Mark as "Hit-For-Pass" for the next 2 minutes
*/
set beresp.ttl = 120 s;
return (hit_for_pass);
}
return (deliver);
}
means "if object is not cacheable - pass client requests for this object to backend directly and simultaneously for 2 minutes, do not queue them"
Read more at https://stackoverflow.com/questions/12691489/varnish-hit-for-pass-means