Servlet中使用 Last-Modified、Expires和Cache-Control

 

long now = System.currentTimeMillis();
long expires = System.currentTimeMillis() + (1000 * 60 * minutes);

response.addDateHeader("Expires", expires);
response.addDateHeader("Last-Modified", now);
response.setHeader("Cache-control", "public, max-age=" + minutes * 60);

 

 

http://www.360doc.com/content/13/0923/11/13247663_316436908.shtml#

posted @ 2016-06-27 11:05  搜索技术  阅读(395)  评论(0编辑  收藏  举报