hhstore / blog

My Tech Blog: about Mojo / Rust / Golang / Python / Kotlin / Flutter / VueJS / Blockchain etc.
https://github.com/hhstore/blog/issues
288 stars 24 forks source link

django: 最佳实践 - 缓存设计(caching) #21

Open hhstore opened 6 years ago

hhstore commented 6 years ago

ref libs:

redis buff:

ref:

hhstore commented 6 years ago

整站缓存配置:


MIDDLEWARE = [
    'django.middleware.cache.UpdateCacheMiddleware',    # 所有中间件之前

    # ...
    'django.middleware.common.CommonMiddleware',
    # ...

    'django.middleware.cache.FetchFromCacheMiddleware',  # 所有中间件之后
]
hhstore commented 6 years ago

缓存: 单个view 页面

image

根据 URL 缓存页面:

image