#24035 closed Bug (fixed)
Poor/incorrect documentation for CACHE_MIDDLEWARE_KEY_PREFIX in relation to CACHES[alias]['KEY_PREFIX']
Reported by: | Frankie Robertson | Owned by: | Frankie Robertson |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
The interaction between CACHES[alias]['KEY_PREFIX']
, CACHE_MIDDLEWARE_KEY_PREFIX
and @cache_page(... key_prefix)
is poorly documented. It should be made explicit that KEY_PREFIX
is always used and combined with CACHE_MIDDLEWARE_KEY_PREFIX
or @cache_page(... key_prefix)
Changes should be made to both ref/settings and topics/cache.
The paragraph at the bottom of https://docs.djangoproject.com/en/dev/topics/cache/#the-per-view-cache is particularly troublesome:
"The two settings can also be combined. If you specify a cache and a key_prefix, you will get all the settings of the requested cache alias, but with the key_prefix overridden.
Having looked through the source it appears as though the setting CACHE_MIDDLEWARE_KEY_PREFIX
OR the argument to @cache_page
is combined with the rest of the cache key using django.utils.cache.get_cache_key
which is then combined with the CACHES[alias]['KEY_PREFIX']
using key_func
.
Change History (4)
comment:1 by , 10 years ago
Description: | modified (diff) |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
In 446b50b90e9e60760618b236d8b0ea75a3b19d5a: