开发者

In Django, can I always force browser and provider caches to load new pages with a global setting?

I have a handful of users on a server. After updating the site, they don't see the new pages. Is there a way to global开发者_开发技巧ly force their browsers and providers to display the new page? Maybe from settings.py? I see there are decorators that look like they do this on a function level.


Depends on browser and cache settings.

There may be no way to tell browsers to do so (as pages are cached, they are not even talking to server, so there is nothing You can do there).

Good trick is to set Vary: Cookie header, so You can always invalidate cache (by changing cookie somewhere) in case of need.


One way to force the browser to load a new page rather than loading the cached version is to change the file name. You could add a date/time to the file name and use a rewrite rule (assuming Apache web server here) to get the new page.

This site gives a quick explanation: http://www.askapache.com/htaccess/mod_rewrite-fix-for-caching-updated-files.html

and google will show many more.

you may also have to examine your cache control headers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜