Disable upstream caching with messages framework
|Reported by:||Torsten Bronger||Owned by:||nobody|
|Cc:||bronger@…||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Upstream caching should be disabled when messages have been consumed in the current request. I added
if request._messages.used: add_never_cache_headers(response)
to "process_response" of MessageMiddleware and it works nicely for me. Doesn't it make sense to do that always, or at least, by default?
When the message framework is used and the messages are iterared over in the current view, this means that it is posible that they are displayed and consumed. Thus, when the same page is retrieved next time, they won't appear, or with different content.
It is very difficult to handle this in cache-related code of that view because the messages have been generated in a previous request, which may even belong to another view.
Change History (5)
comment:1 Changed 7 years ago by
|Component:||Uncategorized → Contrib apps|
|Triage Stage:||Unreviewed → Design decision needed|