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

unexpected keyword argument 'connection_class' #181

Closed rajaravi1 closed 4 years ago

rajaravi1 commented 4 years ago

from django.core.cache import cache cache.set('dfd', ['raja']) Exception ignored in: <object repr() failed> Traceback (most recent call last): File "/home/ubuntu/.pyenv/versions/api-3.6.6/lib/python3.6/site-packages/redis/client.py", line 823, in del self.close() File "/home/ubuntu/.pyenv/versions/api-3.6.6/lib/python3.6/site-packages/redis/client.py", line 826, in close conn = self.connection AttributeError: 'Redis' object has no attribute 'connection' Traceback (most recent call last): File "", line 1, in File "/home/ubuntu/.pyenv/versions/api-3.6.6/lib/python3.6/site-packages/django/core/cache/init.py", line 99, in getattr return getattr(caches[DEFAULT_CACHE_ALIAS], name) File "/home/ubuntu/.pyenv/versions/api-3.6.6/lib/python3.6/site-packages/django/core/cache/init.py", line 80, in getitem cache = _create_cache(alias) File "/home/ubuntu/.pyenv/versions/api-3.6.6/lib/python3.6/site-packages/django/core/cache/init.py", line 55, in _create_cache return backend_cls(location, params) File "/home/ubuntu/.pyenv/versions/api-3.6.6/lib/python3.6/site-packages/redis_cache/backends/single.py", line 21, in init client = self.create_client(server) File "/home/ubuntu/.pyenv/versions/api-3.6.6/lib/python3.6/site-packages/redis_cache/backends/base.py", line 186, in create_client client = self.Redis(**kwargs) TypeError: init() got an unexpected keyword argument 'connection_class'

Test script -

import redis

conn = redis.Redis( host='master.xxxx.rw1fiwa.usw3.cache.amazonaws.com', ssl=True, password='itsCacheTokenWorking')

print(conn) print(conn.ping())

The above test script is working good because passing ssl=True

The reported error (unexpected keyword argument 'connection_class') occurs because django-redis-cache is trying to pass connection_class keyword argument to redis.Redis which is unsupported

I could see that there are fixes suggested: https://github.com/BureauxLocaux/django-redis-cache/commit/18ea61fe8defd8f5631227e0e75a14a5cb0a0c26 but wonder why that is not yet implemented/merged

sebleier commented 4 years ago

Sorry for delay. This has been fixed in 2.1.1. Let me know if you have a problem.

jdavisp3 commented 4 years ago

🚀 Thanks a ton @sebleier !