1
我试图使用Django,Redis的using Unix sockets rather than a TCP connection:Django的redis的配置使用套接字而不是TCP
这是settings.py
配置:
CACHES = {
'default': {
'BACKEND': 'redis_cache.cache.RedisCache',
'LOCATION': 'unix:/tmp/redis.sock:1',
'OPTIONS': {
'PASSWORD': '',
'PICKLE_VERSION': -1, # default
'PARSER_CLASS': 'redis.connection.HiredisParser',
'CLIENT_CLASS': 'redis_cache.client.DefaultClient',
},
},
}
,这是Redis的配置的提取物文件在/etc/redis/6379.conf
:
# Specify the path for the unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
# on a unix socket when not specified.
#
unixsocket /tmp/redis.sock
unixsocketperm 755
尽管如此,我收到一个ConnectionInterrumped
例外,CON期间代表一个错误nection。有关这个配置的问题是什么的想法?
P.S.我的Django版本是1.5.1
,django-redis是3.3
,并且hiredis是0.0.1
。
将'LOCATION' chagning'changning'建议引发'错误格式'/ tmp/redis.sock''消息引发'错误配置'异常。另外,RedisCache类的位置是正确的(我查看了源代码)。 –
@JosvicZammit奇,可能是一个版本的差异,然后,[本页](https://github.com/sebleier/django-redis-cache)似乎同意我的看法。 –
问题是这样的:我使用['django-redis'](https://django-redis.readthedocs.org/en/latest/)而不是['django-redis-cache'](https:/ /github.com/sebleier/django-redis-cache)。我切换到'django-redis-cache',现在按照规定工作。请编辑你的答案,指出不是['django-redis-cache'](https://github.com/sebleier/django-redis-cache)正在被使用,并让我知道,以便我标记它是正确的。谢谢! –