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自带的 有空再研究下

 

posted @   凯宾斯基  阅读(32)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
点击右上角即可分享
微信分享提示