[PATCH] stale-while-revalidate updated

Federico Schwindt fgsch at lodoss.net
Wed Aug 27 19:11:13 CEST 2014


Attached is an updated patch for s-w-r support that I originally sent in
June 23.
I've kept the code outside RFC2616_Ttl but still adding it into
It might be worth merging it and/or moving this into rfc5861_cache.c.

Before this turns into another bike-shedding, a few things worth clarifying:

It only implements stale-while-revalidate as the subject says.
Implementing stale-if-error requires more changes to Varnish and while it
might be implemented in the future is not in the scope of this patch.
I rather have something that people can use now that nothing at all for a
longer period (this diff was sent over 2 months ago).

If ttl is equal or lower than 0 this implementation will ignore the
stale-while-revalidate value. There are 2 reasons for this that are not
related to this diff but to Varnish itself: 1. Varnish won't cache an
object with a 0 ttl and 2. a ttl of -1 indicates that either the response
status was uncacheable (as per RFC2616_Ttl) or that the content already
expired (again based on RFC2616_Ttl).
Should the situation in Varnish change it's as simple of modifying the
check to be `expp->ttl < 0.' so I'd prefer to have that discussion
decoupled from this patch.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20140827/53f2ca68/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0000.stale-while-revalidate.patch
Type: text/x-patch
Size: 2793 bytes
Desc: not available
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20140827/53f2ca68/attachment.bin>

More information about the varnish-dev mailing list