#33604: Allow `CacheMiddleware.key_prefix` to be a callable
------------------------------------------------+------------------------
Reporter: Alexandru Mărășteanu | Owner: nobody
Type: New feature | Status: new
Component: Core (Cache system) | 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 |
------------------------------------------------+------------------------
As discussed in https://groups.google.com/g/django-
developers/c/UbD1DkV1uPo and https://code.djangoproject.com/ticket/11269
it would be useful to be able to specify a callable which would allow for
more dynamic caching. In my case, I need to cache differently depending on
whether the user is authenticated or not. Another scenario is to cache
certain pages depending on some timestamp. Other uses cases were mentioned
in the linked pages.
There exists https://github.com/peterbe/django-fancy-cache but I was able
to address this by extending the built-in middleware so I really don't see
an argument for a 3rd party package.
I'll try to open a PR for this.
--
Ticket URL: <https://code.djangoproject.com/ticket/33604>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107017fd1657e47-0eff897b-d2fb-430b-861b-bbaf34f2d87a-000000%40eu-central-1.amazonses.com.