sebleier / django-redis-cache

A Redis cache backend for django
http://django-redis-cache.readthedocs.org/en/latest/
Other
1.04k stars 223 forks source link

django-redis-cache get_or_set() method is unreachable #185

Open ad-65 opened 4 years ago

ad-65 commented 4 years ago

Using:

Django==3.0.2
django-redis-cache==2.1.0

Configure django-redis-cache per the docs:

CACHES = {
    'default': {
        'BACKEND': 'redis_cache.RedisCache',
        'LOCATION': 'redis://localhost:6379/0',
        'TIMEOUT': 300,
    },
}

Then try:

cache.get_or_set('key', 'non-callable value')

Everything actually works, but django-redis-cache should raise an exception when a non-callable is passed.

It seems that when Django added a get_or_set() method it is now overriding the django-redis-cache get_or_set() method. This would remove the advantage of the built in "thundering herd protection" and is confusing.

Thanks.