前台代码:
<script>
function CleanConfirm(){
var url="/devindex/function";
var data={f:'clearCache'};
$.ajax({
url: url,
type: "post",
dataType: "json",
contentType: "application/json; charset=utf8",
data: data,
success: function(data) {
if(data.success){
layerInfo(data.msg);
}else{
layerInfo(data.msg);
}
}
});
}
</script>
后台代码:
@ResponseBody
@RequestMapping({"/function"})
public Map function(String p_dm, @RequestParam Map<String, Object> paramMap, Model model, HttpServletRequest request, HttpServletResponse response) {
if ("clearCache".equals(paramMap.get("f"))) {
CommonCacheManager commonCacheManager = CommonCacheManager.getCommonCacheManager();
String cacheName = CACHENAME.COMMONAPICONFIG.name();
List<PFunctionsubEntity> pFunctionsubEntities = this.pFunctionSubService.GetOneDataByDm(p_dm);
for(int i = 0; i < pFunctionsubEntities.size(); ++i) {
PFunctionsubEntity pFunctionsubEntity = (PFunctionsubEntity)pFunctionsubEntities.get(i);
commonCacheManager.removeCacheValue(cacheName, pFunctionsubEntity.getId());
commonCacheManager.removeCacheValue(cacheName, pFunctionsubEntity.getDm());
commonCacheManager.removeCacheValue(cacheName, pFunctionsubEntity.getMainid() + pFunctionsubEntity.getDm());
commonCacheManager.removeCacheValue(cacheName, pFunctionsubEntity.getId() + PFunctiontjoptEntity.class.toString());
commonCacheManager.clearCache(pFunctionsubEntity.getDm());
}
if (StringUtil.isEmptyOrLength0(p_dm)) {
commonCacheManager.clearCache(cacheName);
commonCacheManager.clearCache((String)null);
}
Map resMap = new HashMap();
resMap.put("success", "true");
resMap.put("msg", "clearCache:" + (StringUtil.isEmptyOrLength0(p_dm) ? "all" : p_dm));
return resMap;
}
}
评论 (0)