0
這是從django documentation:Django的緩存和條件裝飾
condition(etag_func=None, last_modified_func=None)
etag(etag_func)
last_modified(last_modified_func)
These decorators can be used to generate ETag and Last-Modified headers
,然而,這也從django documentation:
Additionally, the cache middleware automatically sets a few headers in each HttpResponse:
Sets the Last-Modified header to the current date/time when a fresh (uncached) version of the page is requested.
Sets the Expires header to the current date/time plus the defined CACHE_MIDDLEWARE_SECONDS.
Sets the Cache-Control header to give a max age for the page -- again, from the CACHE_MIDDLEWARE_SECONDS setting.
所以我想知道什麼樣的價值不的Last-Modified需要的時候我使用站點緩存和條件裝飾器。
編輯:另外,你會推薦使用它們,還是隻使用它們之一?
我接受了你的答案,但是,你認爲哪一個是最佳實踐?同時使用它們,還是讓緩存句柄最後修改? – yasar