Cache of fetch data


Keywords
cache, fetch
License
MIT
Install
npm install jfetchs@0.1.15

Documentation

jfetchs

NPM version Build Status Coverage Status

封装获取缓存的方法 Cache of fetch data

使用方法 Usage

声明缓存 Declaration cache

var cache = new jfetchs.Cache({
  debug: 'localhost',
  expire: 60, // 60 seconds
  fetch: () => {
    return Promise.resolve(Date.now())
  },
})

cache.fetch().then(data => {
  console.log(data)
})

API

Cache.fetch

/**
 * 获取数据 Fetch cached data
 * @param key 缓存标志,默认: ''
 */
Cache.fetch(key?: string) {}

Cache.flush

/**
 * 移除缓存 Remove cached data
 * @param key 缓存标志,默认: ''
 */
Cache.flush(key?: string) {}

License

MIT © zswang