Respect for no-cache header

Aug 23, 2012 at 5:49 PM
Edited Aug 23, 2012 at 8:52 PM

This does not relate to client caching.  Ctrl+F5 sends a request header even when there is no client cache:

Cache-Control: no-cache

Even if the client is not caching, they can still hit Ctrl-F5 and the server will receive the cache-control:no-cache request header, signaling it to invalidate the server-side cache and run the action.

By default it seemed OutputCache respected this, and would run the action, but Donut Caching doesn't.  While maybe some people don't like this because it allows users to force the action t re-run, I think it might be a good idea to enable support for this.  I personally would like to be able to tell users they can Ctrl+F5 if they feel like something is stale(even though if I had coded everything properly that shouldn't be the case, mistakes happen and I won't them to at least have a work around).

 

(Edit: Ok, I just saw some release notes, in contrast to earlier posts, that indicate you now support the Location enum, so this second suggestion is a bit of a mute point. Yay!) On another note, which does regard client caching, by default, I would also enable client caching if there are not "holes"/Actions(exclude=true), sending the client the duration and when there is not a VaryByCustom.  I believe this is also the default for OutputCache.  I would also enable downstream caching for these scenarios as well.  I don't know what the response header is for that though.  I believe that is also the default for OutputCache, since it uses "Any" for the default location I think(hard to find documentation on the defaults).

Perhaps to support client caching even when there are exclusions, perhaps examine the duration of all children and set the duration to the minimum duration, but this could be pretty complicated and would really require traversing this tree recursively down to any leaf partial actions.  Then of course not doing it at all if any child does VaryByCustom.  Honestly I would probably not bother with this last feature if I were in your shoes for a long time, but it is just a thought to chew on.

Thanks for the great work you have done.

Aug 23, 2012 at 5:54 PM

FYI here is information on what browsers do when Ctrl+F5 is hit:

http://stackoverflow.com/questions/385367/what-requests-do-browsers-f5-and-ctrl-f5-refreshes-generate