缓存自动清理

// JSP页面加入如下代码
<% response.setHeader("Cache-Control","no-store"); response.setHeader("Pragrma","no-cache"); response.setDateHeader("Expires",0); %>

  

// HTML加入如下代码
<meta HTTP-EQUIV="pragma" CONTENT="no-cache"> <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate"> <meta HTTP-EQUIV="expires" CONTENT="0">

$.ajax({ 
type: "GET", 
url: "static/cache.js", 
dataType: "text", 
beforeSend :function(xmlHttp){ 
xmlHttp.setRequestHeader("If-Modified-Since","0"); 
xmlHttp.setRequestHeader("Cache-Control","no-cache");

    } 
});
$.ajax({ 
type: "GET", 
url: "static/cache.js", 
dataType: "text", 
cache:false, 
ifModified :true 
});

  

 

原文地址:https://www.cnblogs.com/zhoucx66/p/5683519.html