Skip to content

Commit 16d0f1b

Browse files
committed
Update README to highlight Django's native Redis support and migration guidance
1 parent 9e7bde2 commit 16d0f1b

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,25 @@ django-cache-url
1414
:target: https://github.com/epicserve/django-cache-url/actions
1515
:alt: Tests
1616

17+
⚠️ Important Notice for Redis Users
18+
------------------------------------
19+
20+
**If you only need Redis cache support**, Django 4.2+ now includes native Redis support via
21+
``django.core.cache.backends.redis.RedisCache``. For new projects using only Redis, we
22+
recommend using Django's built-in support instead of this library.
23+
24+
**This project remains useful for:**
25+
26+
- Supporting non-Redis cache backends (memcached, file, database, etc.)
27+
- Using URL-based cache configuration for any backend (12-factor app pattern)
28+
- Maintaining legacy projects already using django-cache-url
29+
- Projects that need multiple cache backend support with unified configuration
30+
31+
**For Redis-only new projects**: See `Django's cache documentation <https://docs.djangoproject.com/en/stable/topics/cache/#redis>`_
32+
for native Redis setup.
33+
34+
----
35+
1736
This simple Django utility allows you to utilize the
1837
`12factor <http://www.12factor.net/backing-services>`_ inspired
1938
``CACHE_URL`` environment variable to configure your Django application.
@@ -39,6 +58,32 @@ Parse an arbitrary Cache URL::
3958

4059
CACHES = {'default': django_cache_url.parse('memcache://...')}
4160

61+
Migrating to Django's Native Redis Support
62+
-------------------------------------------
63+
64+
If you're using this library only for Redis and want to migrate to Django's built-in Redis backend (Django 4.2+),
65+
here's how to transition:
66+
67+
**Before** (using django-cache-url)::
68+
69+
import django_cache_url
70+
import os
71+
72+
CACHES = {
73+
'default': django_cache_url.config(default='redis://localhost:6379/1')
74+
}
75+
76+
**After** (using Django's native Redis backend)::
77+
78+
CACHES = {
79+
'default': {
80+
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
81+
'LOCATION': 'redis://127.0.0.1:6379/1',
82+
}
83+
}
84+
85+
For more details, see the `Django Redis cache documentation <https://docs.djangoproject.com/en/stable/topics/cache/#redis>`_.
86+
4287
Supported Caches
4388
----------------
4489
Support currently exists for:

0 commit comments

Comments
 (0)