Open hhstore opened 6 years ago
https://docs.djangoproject.com/en/2.0/topics/cache/#the-per-site-cache
两个中间件, 必须一个最前, 一个最后.
开启整站缓存模式.
MIDDLEWARE = [
'django.middleware.cache.UpdateCacheMiddleware', # 所有中间件之前
# ...
'django.middleware.common.CommonMiddleware',
# ...
'django.middleware.cache.FetchFromCacheMiddleware', # 所有中间件之后
]
view
页面
ref libs:
redis
替换 django 默认cache backend
redis buff:
https://github.com/redis/hiredis-py
同时安装 redis-py 和 hiredis, 会自动提高性能.
ref: