[PATCH 2/2] ttl: Support different TTL times based on cache-control

Tim Nordell tim.nordell at logicpd.com
Mon Feb 29 16:08:54 CET 2016

On 02/28/16 06:32, John Keeping wrote:
> On Fri, Feb 26, 2016 at 02:57:09PM -0600, Tim Nordell wrote:
>> Allow the client browser to pass in "max-age=0" and "no-cache"
>> to control a separate TTL time on the server for each type of
>> page.  This extends the TTL field to have the additional form
>> of:
>>      some-ttl=5:1
>> where 5 is the number of minutes if the user were to simply
>> load the page, and 1 is the number of minutes if the user were
>> to reload the page in their web browser (hit refresh).
> Firefox seems to always send "max-age=0" when it has its own cached data
> (along with an If-Modified-Since header).  I don't think we want to use
> the forced value when the user's browser has an existing cached value.

Yes, although, for a new hit (as in not in your local cache yet), 
Firefox will not send "max-age=0".  It will only do this if you hit 
refresh on the page.  If you hold shift while clicking refresh, it'll 
change to "no-cache".

> Overall I'm not convinced CGit should be dealing with this, for advanced
> caching isn't it better to stick Varnish or nginx in front of CGit.

Maybe.  The use case I have is that I want to serve the cached value by 
default, but allow a user to force it to be refreshed on an earlier 
timetable than otherwise permitted.  However, I still want this time to 
be restricted so that one can't cause the server to /always/ generate a 
new page.

Anyone else thoughts?  I'm okay dropping this patchset for the main 
codebase if noone else is interested in this.  I'm just interested in 
not maintaining our own patchsets and would like to get our changes in 
the main codebase if possible.  (This one is low on the priority list 
anyways since it doesn't affect what is displayed - only caching behavior.)

- Tim

More information about the CGit mailing list