This commit is contained in:
xmcp
2019-08-18 16:05:37 +08:00
parent a671a3c84f
commit f580f1b797
4 changed files with 11 additions and 13 deletions

View File

@@ -39,7 +39,7 @@ class Cache {
resolve(null);
} else if(target_version===res.version) { // hit
console.log('cache hit');
res.last_access=+new Date();
res.last_access=(+new Date());
store.put(res);
resolve(res.data);
} else { // expired
@@ -97,4 +97,8 @@ class Cache {
}
};
export let cache=new Cache();
export function cache() {
if(!window._cache)
window._cache=new Cache();
return window._cache;
}