Skip to content

Commit

Permalink
Add support for testing against the builtin redis backend
Browse files Browse the repository at this point in the history
  • Loading branch information
danlamanna committed Sep 3, 2024
1 parent 0a62691 commit 96a3568
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
1 change: 1 addition & 0 deletions cachalot/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'django.core.cache.backends.dummy.DummyCache',
'django.core.cache.backends.locmem.LocMemCache',
'django.core.cache.backends.filebased.FileBasedCache',
'django.core.cache.backends.redis.RedisCache',
'django_redis.cache.RedisCache',
'django.core.cache.backends.memcached.MemcachedCache',
'django.core.cache.backends.memcached.PyLibMCCache',
Expand Down
2 changes: 2 additions & 0 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Requirements
- a cache configured as ``'default'`` with one of these backends:

- `django-redis <https://github.com/niwinz/django-redis>`_
- `redis <https://docs.djangoproject.com/en/dev/topics/cache/#redis>`_
(requires Django >= 4)
- `memcached <https://docs.djangoproject.com/en/dev/topics/cache/#memcached>`_
(using either python-memcached or pylibmc)
- `filebased <https://docs.djangoproject.com/en/dev/topics/cache/#filesystem-caching>`_
Expand Down
5 changes: 5 additions & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
'PICKLE_VERSION': 2,
},
},
'builtin_redis': {
'BACKEND': 'django.core.cache.backends.redis.RedisCache',
# make sure to use a different redis database to avoid conflicts between cache backends
'LOCATION': 'redis://127.0.0.1:6379/1',
},
'memcached': {
'BACKEND': 'django.core.cache.backends.memcached.'
+ ('PyMemcacheCache' if __DJ_V[0] > 2
Expand Down
25 changes: 13 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[tox]
envlist =
py{37,38,39,310}-django3.2-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased},
py{38,39,310}-django4.1-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased},
py{38,39,310,312}-django4.2-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased},
py{310,311,312}-django5.0-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased},
py{310,311,312}-djangomain-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased},
py{38,39,310}-django4.1-{sqlite3,postgresql,mysql}-{builtin_redis,redis,memcached,pylibmc,locmem,filebased},
py{38,39,310,312}-django4.2-{sqlite3,postgresql,mysql}-{builtin_redis,redis,memcached,pylibmc,locmem,filebased},
py{310,311,312}-django5.0-{sqlite3,postgresql,mysql}-{builtin_redis,redis,memcached,pylibmc,locmem,filebased},
py{310,311,312}-djangomain-{sqlite3,postgresql,mysql}-{builtin_redis,redis,memcached,pylibmc,locmem,filebased},

[testenv]
passenv = *
Expand Down Expand Up @@ -35,14 +35,15 @@ deps =
beautifulsoup4
coverage
setenv =
sqlite3: DB_ENGINE=sqlite3
postgresql: DB_ENGINE=postgresql
mysql: DB_ENGINE=mysql
locmem: CACHE_BACKEND=locmem
filebased: CACHE_BACKEND=filebased
redis: CACHE_BACKEND=redis
memcached: CACHE_BACKEND=memcached
pylibmc: CACHE_BACKEND=pylibmc
sqlite3: DB_ENGINE=sqlite3
postgresql: DB_ENGINE=postgresql
mysql: DB_ENGINE=mysql
locmem: CACHE_BACKEND=locmem
filebased: CACHE_BACKEND=filebased
redis: CACHE_BACKEND=redis
builtin_redis: CACHE_BACKEND=builtin_redis
memcached: CACHE_BACKEND=memcached
pylibmc: CACHE_BACKEND=pylibmc
commands =
coverage run -a --source=cachalot ./runtests.py

Expand Down

0 comments on commit 96a3568

Please sign in to comment.