what is the ttl?

Per Buer perbu at varnish-software.com
Wed Aug 27 09:23:37 CEST 2014


On Tue, Aug 26, 2014 at 7:59 PM, Nils Goroll <slink at schokola.de> wrote:

> (..)
> I think we should make this consistent and easier to understand.
>
> One simple idea to regain consistency would be to make a "set beresp.ttl"
> do
> what a read on obj.ttl gives us: the time remaining in cache (ie add the
> Age to
> the internal ttl).
>


While I see the point the issue is further complicated by the grace and
keep timeouts, which in effect extends the TTL. This is much more of a real
issue now that the default VCL will serve an object past the TTL using the
builtin VCL.

In addition to that (or even replacing the VCL ttl) I like the idea to add
> two
> (additional) variables:
>
> * (beresp|obj).age : corresponding to the Age header, the current Age
>   of the Object
>

If obj.ttl could reflect the real ttl and obj.age is exposed then we could
have vcl_hit look like:

if (obj.ttl - obj.age >= 0s) {
        return (deliver);
}
if (obj.ttl + obj.grace - obj.age > 0s) {
         // Object is in grace, deliver it
         // Automatically triggers a background fetch
         return (deliver);
}

This would have the advantage that everyone would immediately see how TTL
and age work together. It would still make sense to have the calculated TTL
available of course, but more for convenience.

Per.

-- 
 <http://www.varnish-software.com/> *Per Buer*
CTO | Varnish Software
Phone: +47 958 39 117 | Skype: per.buer
We Make Websites Fly!

Winner of the Red Herring Top 100 Global Award 2013
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20140827/e52295e7/attachment-0001.html>


More information about the varnish-dev mailing list