封装获取缓存的方法 Cache of fetch data
var cache = new jfetchs.Cache({
debug: 'localhost',
expire: 60, // 60 seconds
fetch: () => {
return Promise.resolve(Date.now())
},
})
cache.fetch().then(data => {
console.log(data)
})
/**
* 获取数据 Fetch cached data
* @param key 缓存标志,默认: ''
*/
Cache.fetch(key?: string) {}
/**
* 移除缓存 Remove cached data
* @param key 缓存标志,默认: ''
*/
Cache.flush(key?: string) {}
MIT © zswang