# cache-api

> cache data from display api.useful for working on the front end.

Latest version **1.1.1** (published 2023-06-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install cache-api
pnpm add cache-api
yarn add cache-api
bun add cache-api
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2023-06-16 |
| First published | 2023-06-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 17.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | yokasu |
| Maintainers | yokasu |
| Keywords | cache, api, javascript, front-end |

## Links

- npm: https://www.npmjs.com/package/cache-api
- Repository: https://github.com/yokasu/cache-api
- Homepage: https://github.com/yokasu/cache-api#readme
- Issues: https://github.com/yokasu/cache-api/issues
- npm.io page: https://npm.io/package/cache-api

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2023-06-16
- 1.1.0 — 2023-06-16
- 1.0.14 — 2023-06-16
- 1.0.13 — 2023-06-16
- 1.0.12 — 2023-06-16
- 1.0.11 — 2023-06-16
- 1.0.10 — 2023-06-16
- 1.0.9 — 2023-06-16
- 1.0.8 — 2023-06-16
- 1.0.7 — 2023-06-16
- 1.0.6 — 2023-06-15
- 1.0.5 — 2023-06-15
- 1.0.4 — 2023-06-15
- 1.0.3 — 2023-06-15
- 1.0.2 — 2023-06-15
- … 2 more at https://npm.io/package/cache-api/versions

## README

# cache-api
  
  cache data from display api.useful for working on the front end.
  
  ## 安装
  
  ```bash
  npm install cache-api --save
  ```
  
  ## 使用
  // 案例一
  ```javascript
  import CacheApi from 'cache-api';
  import request from '@/utils/request'
  export const getList = new CacheApi((data) => {
    request({
      url: 'user/list',
      method: 'get',
      data
    })
  })
  // .vue
  import { getList } from '@/api/user'
  const data = {
    current: 1,
    pageSize: 10,
  }

  getList.send(data).then(res => {

  })

  getList.forceSend(data).then(res => {

  })

  getList.send(data, true).then(res => {

  })

  ```
  // 案例二
  ```javascript
  import { createCacheAPI } from 'cache-api';
  import request from '@/utils/request'
  const getList = (data) => {
    request({
      url: 'user/list',
      method: 'get',
      data
    })
  }
  export const getListCache = createCacheAPI(getListRaw, {
    filters: [res => res],
  })
  // .vue
  import { sendCacheAPI } from 'cache-api'
  import { getList } from '@/api/user'
  const data = {
    current: 1,
    pageSize: 10,
  }

  sendCacheAPI("getList")(data).then(res => {

  })

  sendCacheAPI(getList)(data).then(res => {

  })
  
  sendCacheAPI(getList, true)(data).then(res => {

  })
  ```
  
  ## 许可证
  
  ISC © yokasu

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