<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi,<br class=""><div class=""><br class=""></div><div class="">What I work with:</div><div class=""><br class=""></div><div class="">* Grace mode configured to be 60 seconds when backend is healthy</div><div class="">* Using softpurge module to adjust TTL to 0 upon PURGE.</div><div class=""><br class=""></div><div class="">The whole idea is increasing chances that visitors will get cached page after cache was PURGEd for a page.</div><div class=""><br class=""></div><div class="">Standard piece:</div><div class=""><pre style="background-color: rgb(255, 255, 255); font-family: Monaco; font-size: 8.3pt;" class="">sub vcl_hit {<br class="">    if (obj.ttl >= 0s) {<br class="">        # normal hit<br class="">        return (deliver);<br class="">    }<br class=""><br class="">    if (std.healthy(req.backend_hint)) {<br class="">        # Backend is healthy. Limit age to 60s.<br class="">        if (obj.ttl + 60s > 0s) {<br class="">            set req.http.grace = "normal(limited)";<br class="">            return (deliver);<br class="">        } else {<br class="">            return(fetch);<br class="">        }<br class="">    } else {<br class="">        # ...<br class="">    }<br class="">}</pre><div class="">And use of softpurge:</div></div><div class=""><br class=""></div><div class=""><pre style="background-color: rgb(255, 255, 255); font-family: Monaco; font-size: 8.3pt;" class="">sub vcl_miss {<br class="">    if (req.method == "PURGE") {<br class="">        softpurge.softpurge();<br class="">        return (synth(200, "Successful softpurge"));<br class="">    }<br class="">}<br class=""><br class="">sub vcl_hit {<br class="">    if (req.method == "PURGE") {<br class="">        softpurge.softpurge();<br class="">        return (synth(200, "Successful softpurge"));<br class="">    }<br class="">}</pre><div class=""><br class=""></div></div><div class=""><br class=""></div><div class="">Current behaviour:</div><div class=""><br class=""></div><div class="">* send PURGE for cached page</div><div class="">* Visitor goes to the page within 60 seconds and sees a stale cached page (triggering background refresh)</div><div class="">* Further visits to the page will show refreshed page</div><div class=""><br class=""></div><div class="">What I’m looking for:</div><div class=""><br class=""></div><div class="">Trigger the background refresh right after PURGE while still leveraging grace mode :) That is, serve stale cache for only as long as it takes to actually generate the new page, and not wait for 60 seconds:</div><div class=""><br class=""></div><div class="">* upon PURGE: set TTL to 0 (softpurge) + trigger background page request (possible?)</div><div class="">* serve stale cache only while the page is generated</div><div class=""><br class=""></div><div class="">I could have adjusted the “healthy backend grace period” to lower than 60s, but I’m basically checking to see if it’s possible to refresh “nearly” immediately in this kind of setup.</div><div class=""><br class=""></div><div class="">Hope I made any sense :) </div><div class=""><br class=""><div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Best Regards,</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Danila</div></div>
</div>

<br class=""></div></body></html>