Varnish cache - how long the pages are cached? Varnish cache - how long the pages are cached? apache apache

Varnish cache - how long the pages are cached?


If your seeing the latest contents each time you refresh then you haven't set varnish up properly.

Varnish should sit on a different port to Apache so make sure your visiting test.php on the varnish port.

You can put this in your config to see if it's caching..

sub vcl_deliver {    # Add a header to indicate a cache HIT/MISS    if (obj.hits > 0) {        set resp.http.X-Cache = "HIT";    } else {        set resp.http.X-Cache = "MISS";    }    return (deliver);}

If you see the X-Cache header then you know it's at least running through varnish.


The http headers you're setting in your pages play a great role to decide whether they will be cached or not. Read the varnish documentation about this


This thread looks old. But this value can be found in the vanish config set the value for VARNISH_TTL

# # Default TTL used when the backend does not specify oneVARNISH_TTL= 120

The default is 120 seconds I am sure you can change it from that point