提交 d522041e 编写于 作者: tony001's avatar tony001

动态代码表启用缓存缓存超长时长为-1应不缓存

上级 be99d057
...@@ -165,12 +165,8 @@ export default class CodeListService { ...@@ -165,12 +165,8 @@ export default class CodeListService {
if(CodeListService.codelistCached.get(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`)){ if(CodeListService.codelistCached.get(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`)){
let items:any = CodeListService.codelistCached.get(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`).items; let items:any = CodeListService.codelistCached.get(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`).items;
if(items.length >0){ if(items.length >0){
if(cacheTimeout !== -1){ if(new Date().getTime() <= codelist.getExpirationTime()){
if(new Date().getTime() <= codelist.getExpirationTime()){ return resolve(items);
return resolve(items);
}
}else{
return resolve(items);
} }
} }
} }
...@@ -181,9 +177,7 @@ export default class CodeListService { ...@@ -181,9 +177,7 @@ export default class CodeListService {
}else{ }else{
let result:Promise<any> = codelist.getItems(context,data,isloading); let result:Promise<any> = codelist.getItems(context,data,isloading);
CodeListService.codelistCache.set(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`,result); CodeListService.codelistCache.set(`${JSON.stringify(context)}-${JSON.stringify(data)}-${tag}`,result);
if(cacheTimeout !== -1){ codelist.setExpirationTime(new Date().getTime() + cacheTimeout);
codelist.setExpirationTime(new Date().getTime() + cacheTimeout);
}
callback(context,data,tag,result); callback(context,data,tag,result);
} }
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册