缓存模块
最后更新于:2022-04-01 23:48:14
# 缓存模块
## 清除缓存
~~~
function fnClearCache() {
api.showProgress({
title : '清除缓存中...',
});
api.clearCache(function() {
setTimeout(function() {
api.hideProgress();
fnGetCacheSize();
}, 500)
});
}
~~~
## 获取缓存
~~~
function fnGetCacheSize() {
api.getCacheSize(function(ret) {
if (ret) {
var size = parseInt(ret.size / 1024 / 1024 * 100) / 100 + ' MB';
var cacheSize = $api.byId('cacheSize');
cacheSize.innerHTML = size;
}else{
var cacheSize = $api.byId('cacheSize');
cacheSize.innerHTML = '0MB';
}
});
}
~~~
';