#24035: Poor/incorrect documentation for CACHE_MIDDLEWARE_KEY_PREFIX in
relation to
CACHES[alias]['KEY_PREFIX']
-------------------------------+------------------------------------
Reporter: frankier | Owner: frankier
Type: Bug | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):
* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted
Old description:
> 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.
New description:
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`.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/24035#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.92b4d60cb06177f39b54b83d1d1225aa%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.