缓存页面代码
1 1 private void setClientCache(HttpServletResponse response, int maxAgeSec) 2 2 { 3 3 long maxAgeMill = maxAgeSec * 1000L; 4 4 Date now = new Date(); 5 5 response.setHeader("Cache-Control", "max-age=" + maxAgeSec); 6 6 response.addDateHeader("Last-Modified", now.getTime()); 7 7 response.addDateHeader("Expires", now.getTime() + maxAgeMill); 8 8 }