我正在尝试使用django-redis using Unix sockets rather than a TCP connection
这是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',
},
},
}这是位于/etc/redis/6379.conf的redis配置文件的摘录
# 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异常,它代表连接过程中的错误。关于这个配置的问题有什么想法吗?
附注:我的Django版本是1.5.1,django-redis是3.3,hiredis是0.0.1。
发布于 2013-07-09 23:32:18
编辑:显然我读错了缓存提供程序,下面的答案是django-redis-cache的解决方案,而不是django-redis。不过,我将保留答案,因为更改缓存提供程序并使用此配置似乎已经解决了问题。
您应该不需要unix:前缀,并且后端设置看起来很奇怪;
'default': {
'BACKEND': 'redis_cache.RedisCache',
'LOCATION': '/tmp/redis.sock',
'OPTIONS': { ...https://stackoverflow.com/questions/17552123
复制相似问题