#36560: When the Cache-Control header is set to no-store, the response is cached.
-------------------------------------+-------------------------------------
Reporter: mengxunQAQ | Owner: (none)
Type: Bug | Status: new
Component: Core (Cache system) | Version: 5.2
Severity: Normal | Resolution:
Keywords: cache | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by mengxunQAQ:
Old description:
> {{{
> from django.http import HttpResponse
> import datetime
>
> def cache_demo(request):
> resp = HttpResponse(f"Current content at {datetime.datetime.now()}")
> resp["Cache-Control"] = "no-store"
> return resp
>
> }}}
> Based on the example above, when the Cache-Control header is set to no-
> store, the response content is still cached.
New description:
**settings.py**
{{{
...
MIDDLEWARE = [
"django.middleware.cache.UpdateCacheMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.cache.FetchFromCacheMiddleware",
]
...
}}}
**views.py**
{{{
from django.http import HttpResponse
import datetime
def cache_demo(request):
resp = HttpResponse(f"Current content at {datetime.datetime.now()}")
resp["Cache-Control"] = "no-store"
return resp
}}}
Based on the example above, when the Cache-Control header is set to no-
store, the response content is still cached.
--
--
Ticket URL: <
https://code.djangoproject.com/ticket/36560#comment:1>