Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zswang/jfetchs
cache of fetch data
https://github.com/zswang/jfetchs
cache fetch
Last synced: about 1 month ago
JSON representation
cache of fetch data
- Host: GitHub
- URL: https://github.com/zswang/jfetchs
- Owner: zswang
- License: mit
- Created: 2018-06-28T08:19:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-13T08:41:38.000Z (about 6 years ago)
- Last Synced: 2024-10-03T06:38:57.663Z (about 1 month ago)
- Topics: cache, fetch
- Language: JavaScript
- Size: 49.8 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## jfetchs
# [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage Status][coverage-image]][coverage-url]
封装获取缓存的方法 Cache of fetch data
## 使用方法 Usage
### 声明缓存 Declaration cache
```js
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
```js
/**
* 获取数据 Fetch cached data
* @param key 缓存标志,默认: ''
*/
Cache.fetch(key?: string) {}
```### Cache.flush
```js
/**
* 移除缓存 Remove cached data
* @param key 缓存标志,默认: ''
*/
Cache.flush(key?: string) {}
```## License
MIT © [zswang](http://weibo.com/zswang)
[npm-url]: https://npmjs.org/package/jfetchs
[npm-image]: https://badge.fury.io/js/jfetchs.svg
[travis-url]: https://travis-ci.org/zswang/jfetchs
[travis-image]: https://travis-ci.org/zswang/jfetchs.svg?branch=master
[coverage-url]: https://coveralls.io/github/zswang/jfetchs?branch=master
[coverage-image]: https://coveralls.io/repos/zswang/jfetchs/badge.svg?branch=master&service=github