Registry / database / django-redis-cache

django-redis-cache

JSON →
library3.0.1pypypiunverified

A Redis cache backend for Django, providing a simple and efficient way to use Redis as your cache store. Current version is 3.0.1. The library is stable with infrequent releases, mainly maintenance updates. It supports Django 2.2+.

pip install django-redis-cache
INSTALL
IMPORT
SIG · DJANGO-REDIS-CACHE
D
django-redis-cache
databasepythonv3.0.1
Install
2.6s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.6s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RedisCache
from redis_cache import RedisCache
from redis_cache import RedisCache

Configure the Redis cache backend and use Django's cache API.

# settings.py CACHES = { 'default': { 'BACKEND': 'redis_cache.RedisCache', 'LOCATION': 'redis://127.0.0.1:6379/1', 'OPTIONS': { 'CLIENT_CLASS': 'redis_cache.client.DefaultClient', } } } # Usage from django.core.cache import cache cache.set('my_key', 'hello', timeout=300) print(cache.get('my_key'))
Debug
Known issues
gotchaDo not confuse django-redis-cache with django-redis. They have different import paths and backends. django-redis-cache uses BACKEND = 'redis_cache.RedisCache' while django-redis uses 'django_redis.cache.RedisCache'.
fix
Ensure you install the correct library and use the correct backend string.
affects: all
breakingVersion 3.0.0 renamed the package from 'redis_cache' to 'django-redis-cache'. The import path changed from 'redis_cache' to 'redis_cache'? Actually, the module name is still 'redis_cache', but the pip package changed. Ensure you use 'pip install django-redis-cache'.
fix
If you previously installed 'redis-cache', you need to uninstall and install 'django-redis-cache'.
affects: >=3.0.0
deprecatedThe 'redis_cache.cache.RedisCache' class is deprecated; use 'redis_cache.RedisCache' directly.
fix
Update your CACHES settings: BACKEND = 'redis_cache.RedisCache'
affects: >=3.0.0
Upgrade
Version history
3.0.1latest on PyPI · released Mar 9, 2022
Audit
Dependencies
redisrequiredRequired Redis client library
DjangorequiredDjango framework
Agent activity
24 hits · last 30 days
node
22
OpenAI (training)
1
Resources
django-redis-cache — pip install django-redis-cache · libregistry