Obj.ttl in Varnish 4.0

Question about obj.ttl in Varnish 4.0

I have a slight problem with varnish and hope someone can help me. I am using varnish 4.0 and I want to increase obj.ttl based on obj.hits

sub vcl_hit { if (obj.hits == 1000) { set obj.ttl = 7d; } } sub vcl_fetch { set beresp.ttl = 20m; } 

Sorry, I am getting an error. Message from the VCC compiler:

  Variable 'obj.ttl' is read only. At: ('input' Line 46 Pos 21) 
+6
source share
1 answer

In Varnish 4, the entire obj variable is read-only :

obj is now read-only

obj is now read-only. obj.hits, if included in VCL, is now counted for an object object, not an object. obj.last_use is deleted.

Use beresp.ttl instead ( see VCL link ). I suggest reading the entire document Upgrading to Varnish 4 .

+7
source

All Articles