Skip to content

Swap the Redis Cache client

Aaron Kable requested to merge aaronkable/allianceauth:rediscache into v3.x

Why

The repo django-redis-cache we currently use looks to have been abandoned, https://github.com/sebleier/django-redis-cache

the Jazzband repo is currently maintained, and has some nice extra features. https://github.com/jazzband/django-redis

Why not native Django-4.0 redis-cache

IMO one nice to have feature that will help larger installations, compression.

I ran into an issue where my Redis got so large that I simply didn't have enough ram to run Redis and MySQL. So I installed this version and enabled compression, as per the commented out section ion local.py my Redis ram use is ~35% of what it used to be, with no noticeable change in performance.

Issues

This does however use a new "Raw client access method" so there may be issues if 3rd party apps use the client accessor from the old repo. you can see the changes needed in the discord client in the patch.

old

from django.core.cache import caches
default_cache = caches['default']
redis = default_cache.get_master_client()

new

from django_redis import get_redis_connection
redis = get_redis_connection("default")

Testing

I have been ruining this for about a month in production with zero issues. I actually have seen a boost in performance I am not sure if it is just cause I have more ram free or not though.

Merge request reports