function getCache(key, hour = 4) { let k = 'chche:' + key let ct = Date.parse(new Date()) / 1000; let ca = my.getStorageSync({ 'key': k }).data if (ca) { if ((ct - ca.time) < (hour * 60 * 60)) { return ca.value } return false } return false } function setCache(key, data = {}, hour = 4) { let k = 'chche:' + key let ct = Date.parse(new Date()) / 1000; my.setStorageSync({ 'key': k, 'data': { 'time': ct, 'value': data } }) } const CacheKeys = { '': "" } module.exports = { getCache: getCache, setCache: setCache, CacheKeys: CacheKeys }