[Django] #35770: Improve recommendation for ignoring memcached-incompatible cache key warnings

4 views
Skip to first unread message

Django

unread,
Sep 17, 2024, 12:12:43 PM9/17/24
to django-...@googlegroups.com
#35770: Improve recommendation for ignoring memcached-incompatible cache key
warnings
-------------------------------------+-------------------------------------
Reporter: Markus Amalthea | Type:
Magnuson | Cleanup/optimization
Status: new | Component:
| Documentation
Version: dev | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
This section of the docs is a bit confusing to me:

https://docs.djangoproject.com/en/5.1/topics/cache/#cache-key-warnings

Why is the recommendation to add the code to a management module (and it's
also not entirely clear what that means, especially for less experienced
Python developers)? Wouldn't it be better to add it to the ready() method
in one of your app configs?

I could not reliably get the first method to work, but the second one
does, and is kind of what the ready() method is for?

I'd be happy to provide updated docs if this sounds like a reasonable
change.
--
Ticket URL: <https://code.djangoproject.com/ticket/35770>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 17, 2024, 3:01:39 PM9/17/24
to django-...@googlegroups.com
#35770: Improve recommendation for ignoring memcached-incompatible cache key
warnings
-------------------------------------+-------------------------------------
Reporter: Markus Amalthea | Owner: (none)
Magnuson |
Type: | Status: new
Cleanup/optimization |
Component: Core (Cache system) | Version: dev
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 Natalia Bidart):

* component: Documentation => Core (Cache system)
* stage: Unreviewed => Accepted

Comment:

Hello Markus, thank you for taking the time to create this ticket. I agree
that "management module" is a bit unclear. For me, that means adding the
shown code inside the `__init__.py` file located at the toplevel of any
`management` folder in any app.

What did you try and what did not work?

Overall I think we can enhance the docs, at least making it more explicit
what the "management module" is, so I'll accept on that basis.
--
Ticket URL: <https://code.djangoproject.com/ticket/35770#comment:1>

Django

unread,
Sep 17, 2024, 3:29:48 PM9/17/24
to django-...@googlegroups.com
#35770: Improve recommendation for ignoring memcached-incompatible cache key
warnings
-------------------------------------+-------------------------------------
Reporter: Markus Amalthea | Owner: (none)
Magnuson |
Type: | Status: new
Cleanup/optimization |
Component: Core (Cache system) | Version: dev
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
-------------------------------------+-------------------------------------
Comment (by Markus Amalthea Magnuson):

I did exactly that, adding the code to `__init_.py` inside of a
`management` folder (with no additional files) in an app that is in
`INSTALLED_APPS`. Tried two different apps, but the code just would not
run. Not sure about the internals of detecting it in such a module
specifically, but seems like there are better way to put code that needs
to always run.
--
Ticket URL: <https://code.djangoproject.com/ticket/35770#comment:2>

Django

unread,
Sep 18, 2024, 5:34:00 PM9/18/24
to django-...@googlegroups.com
#35770: Improve recommendation for ignoring memcached-incompatible cache key
warnings
-------------------------------------+-------------------------------------
Reporter: Markus Amalthea | Owner: Aditya
Magnuson | Chaudhary
Type: | Status: assigned
Cleanup/optimization |
Component: Core (Cache system) | Version: dev
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 Aditya Chaudhary):

* owner: (none) => Aditya Chaudhary
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35770#comment:3>

Django

unread,
Sep 18, 2024, 5:45:04 PM9/18/24
to django-...@googlegroups.com
#35770: Improve recommendation for ignoring memcached-incompatible cache key
warnings
-------------------------------------+-------------------------------------
Reporter: Markus Amalthea | Owner: Aditya
Magnuson | Chaudhary
Type: | Status: assigned
Cleanup/optimization |
Component: Core (Cache system) | Version: dev
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
-------------------------------------+-------------------------------------
Comment (by Aditya Chaudhary):

So, Is this right for the changes. Should I proceed with it ?

``If you are using a caching backend that accepts a wider range of keys
(e.g., a custom backend or one of the non-Memcached built-in backends) and
you prefer to suppress these warnings, you can do so with the following
code. This code can be added to the ready() method of an AppConfig class
in one of your INSTALLED_APPS, which is a more integrated and commonly
used approach:``
--
Ticket URL: <https://code.djangoproject.com/ticket/35770#comment:4>
Reply all
Reply to author
Forward
0 new messages