django-redis
https://blog.csdn.net/qq_39147299/article/details/127655010
中文文档 https://django-redis-chs.readthedocs.io/zh_CN/latest/#
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1",
"OPTIONS": {
# "CLIENT_CLASS": "django_redis.client.DefaultClient",
"CONNECTION_POOL_KWARGS": {"max_connections": 100}
}
}
}
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://{}:{}/{}".format(redis_config.host, redis_config.port, redis_config.db),
"TIMEOUT": 60 * 60 * 24,
"OPTIONS": {
# 自动将byte转成字符串
"DECODE_RESPONSES": True,
"PASSWORD": redis_config.pwd,
# 连接池配置
"CONNECTION_POOL_KWARGS": {"max_connections": 100},
"CLIENT_CLASS": "django_redis.client.DefaultClient",
# 开启压缩,默认不开始
"COMPRESSOR": "django_redis.compressors.lzma.LzmaCompressor",
},
},
}
没成功用了python自带的 有空再研究下

浙公网安备 33010602011771号