-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Code of Conduct
- I agree to follow Django's Code of Conduct
Feature Description
Store the alias used to fetch a cache backend instance on the instance itself.
from django.core.cache import cache
print(cache.alias)
# "default"Note: It may be beneficial to do this for all implementations of BaseConnectionHandler.
Problem
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.
Request or proposal
proposal
Additional Details
It seems reasonable for a user to determine which alias was used when you have a cache backend instance. This may be useful in other contexts that I haven't encountered.
Implementation Suggestions
- Update
CacheHandler.create_connectionto passaliasasbackend_cls(location, params, alias=alias) - Update
django.core.cache.backends.base.BaseCache.__init__to accept and storealias
ertgl, carltongibson, fdemmer and kevinrenskersfelixxm, UnknownPlatypus and kevinrenskers
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Idea