# @aniu2017/egg-request-cache

> Egg插件，HTTP响应报文缓存

Latest version **0.1.1** (published 2020-03-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @aniu2017/egg-request-cache
pnpm add @aniu2017/egg-request-cache
yarn add @aniu2017/egg-request-cache
bun add @aniu2017/egg-request-cache
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2020-03-16 |
| First published | 2020-03-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 1 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | aniu2017 |
| Maintainers | aniu2017 |
| Keywords | egg, eggPlugin, egg-plugin |

## Links

- npm: https://www.npmjs.com/package/@aniu2017/egg-request-cache
- npm.io page: https://npm.io/package/@aniu2017/egg-request-cache

## Dependencies (1)

- [md5](https://npm.io/package/md5.md) ^2.2.1

## Recent versions

- 0.1.1 (latest) — 2020-03-16
- 0.1.0 — 2020-03-13

## README

# egg-request-cache
只是代理了Egg内置的curl函数，参数都与curl保持一致



## Install

```bash
$ npm i @aniu2017/egg-request-cache -S
```

## Usage

```js
// {app_root}/config/plugin.js
exports['request-cache'] = {
  enable: true,
  package: 'egg-request-cache',
};
```

## Configuration

```js
// {app_root}/config/config.default.js
exports.requestCache = {
  expiresTime: '', // 缓存时间 单位毫秒
  redisPrefixKey: 'test', // redis key前缀 可选
};
```

see [config/config.default.js](config/config.default.js) for more detail.

## Example

<!-- example here -->
```javascript
  // {app_root}/Controller/user.js

  // 默认设置了 dataType json method get
  await this.app.requestCache.get('http://127.0.0.1:7001/users');
  // 默认设置了 dataType json method post
  await this.app.requestCache.post('http://127.0.0.1:7001/users', [options]);

  // 没默认值
  await this.app.requestCache('http://127.0.0.1:7001/users', [options]);
```

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