# jfetchs

> Cache of fetch data

Latest version **1.0.4** (published 2018-10-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install jfetchs
pnpm add jfetchs
yarn add jfetchs
bun add jfetchs
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-10-13 |
| First published | 2018-06-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 25.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | zswang |
| Maintainers | zswang |

## Links

- npm: https://www.npmjs.com/package/jfetchs
- Repository: https://github.com/zswang/jfetchs
- Homepage: https://github.com/zswang/jfetchs#readme
- Issues: https://github.com/zswang/jfetchs/issues
- npm.io page: https://npm.io/package/jfetchs

## Dependencies (2)

- [jfetchs-util](https://npm.io/package/jfetchs-util.md) ^0.0.1
- [jfetchs-memory](https://npm.io/package/jfetchs-memory.md) ^0.0.6

## Recent versions

- 1.0.4 (latest) — 2018-10-13
- 1.0.0 — 2018-09-26
- 0.1.27 — 2018-09-16
- 0.1.26 — 2018-09-12
- 0.1.15 — 2018-08-21
- 0.1.9 — 2018-07-03
- 0.1.3 — 2018-06-29
- 0.1.0 — 2018-06-29
- 0.0.13 — 2018-06-29
- 0.0.12 — 2018-06-29
- 0.0.11 — 2018-06-28
- 0.0.10 — 2018-06-28
- 0.0.7 — 2018-06-28

## 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

---
_Source: https://npm.io/package/jfetchs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
