Skip to content

Store the cache alias on the cache backend instance #95

@tim-schilling

Description

@tim-schilling

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Idea

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions