MCPcopy Create free account
hub / github.com/Moli-X/Other / reloadAppSubCache

Function reloadAppSubCache

Backups/KeLee/Resource/Script/BoxJS/BoxJS.js:746–763  ·  view source on GitHub ↗

* =================================== * 工具类函数 * ===================================

(url)

Source from the content-addressed store, hash-verified

744 */
745
746function reloadAppSubCache(url) {
747 // 地址后面拼时间缀, 避免 GET 缓存
748 const requrl = `${url}${
749 url.includes('?') ? '&' : '?'
750 }_=${new Date().getTime()}`
751 return $.http.get(requrl).then((resp) => {
752 try {
753 const subcaches = getAppSubCaches()
754 subcaches[url] = $.toObj(resp.body)
755 subcaches[url].updateTime = new Date()
756 $.setjson(subcaches, $.KEY_app_subCaches)
757 $.log(`更新订阅, 成功! ${url}`)
758 } catch (e) {
759 $.logErr(e)
760 $.log(`更新订阅, 失败! ${url}`)
761 }
762 })
763}
764
765async function reloadAppSubCaches() {
766 $.msg($.name, '更新订阅: 开始!')

Callers 3

apiAddAppSubFunction · 0.85
apiReloadAppSubFunction · 0.85
reloadAppSubCachesFunction · 0.85

Calls 6

getAppSubCachesFunction · 0.85
getMethod · 0.45
toObjMethod · 0.45
setjsonMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…