jfetchs
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i jfetchs

Weekly Downloads

8

Version

1.0.4

License

MIT

Unpacked Size

26 kB

Total Files

6

Last publish

Collaborators

  • zswang