Get redis connection in django4.0

Wondering how to get a redis connection in django4.0 with django.core.cache.backends.redis.RedisCache

by django_redis, from django_redis import get_redis_connection works good. :thinking:

I suspect if you have the cache instance, you can access it via cache._cache.get_client(). Looking at RedisCache, we can see how it creates an instance of RedisCacheClient. Then looking at RedisCacheClient, we can see how it generates a client instance to support the API.

1 Like