[Django] #37153: Store the cache alias on the cache backend instance

1 view
Skip to first unread message

Django

unread,
4:36 PM (5 hours ago) 4:36 PM
to django-...@googlegroups.com
#37153: Store the cache alias on the cache backend instance
-------------------------------------+-------------------------------------
Reporter: Tim Schilling | 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: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Store the alias used to fetch a cache backend instance on the instance
itself. The Django Debug Toolbar is having to do some extra patching
(django-commons/django-debug-toolbar#2219) to retain what alias is being
used for which cache. While tolerable, it means the toolbar is having to
reimplement more parts of Django, making it more brittle for future
versions.

django/new-features: https://github.com/django/new-features/issues/95

Ideal code:

{{{
from django.core.cache import cache

print(cache.alias)
# "default"
}}}

I believe we need to make the following changes:
- Update CacheHandler.create_connection to pass alias as
backend_cls(location, params, alias=alias)
- Update django.core.cache.backends.base.BaseCache.__init__ to accept and
store alias
--
Ticket URL: <https://code.djangoproject.com/ticket/37153>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
4:39 PM (5 hours ago) 4:39 PM
to django-...@googlegroups.com
#37153: Store the cache alias on the cache backend instance
-------------------------------------+-------------------------------------
Reporter: Tim Schilling | Owner: (none)
Type: New feature | Status: closed
Component: Core (Cache system) | Version: dev
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* resolution: => duplicate
* status: new => closed

Comment:

See you in #36830!
--
Ticket URL: <https://code.djangoproject.com/ticket/37153#comment:1>
Reply all
Reply to author
Forward
0 new messages