清漆caching – 默认的TTL?

我发现我可以在VCL文件中如下设置TTL:

sub vcl_fetch { # 1 minute set obj.ttl = 1m; } 

但是什么是默认设置(假设后端服务器没有设置caching控制头)?

    这是在默认模板中:

     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); } 

    那么,120秒。

    默认TTL可以通过-t命令行开关通过varnishd命令传递,可能来自文件系统上的属性文件。 在CentOS系统上,我正在使用/etc/sysconfig/varnish DEFAULT_TTL来设置它。

    你可以看到使用varnishadm的现场设置像这样,

     varnishadm param.show default_ttl 

    实际上,遵循默认的VCL逻辑涉及不可caching的对象。

      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); } 

    意思是“如果对象不可caching – 直接并且同时将该对象的客户端请求传递给后端2分钟,不要排队”

    阅读更多在https://stackoverflow.com/questions/12691489/varnish-hit-for-pass-means