# memory-cache-decorator

> Memory cache decorator

Latest version **1.2.0** (published 2018-04-17) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install memory-cache-decorator
pnpm add memory-cache-decorator
yarn add memory-cache-decorator
bun add memory-cache-decorator
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2018-04-17 |
| First published | 2017-01-17 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jordi López |
| Maintainers | jlopezxs |
| Keywords | es6, cache, decorator |

## Links

- npm: https://www.npmjs.com/package/memory-cache-decorator
- Repository: https://github.com/jlopezxs/memory-cache-decorator
- Issues: https://github.com/jlopezxs/memory-cache-decorator/issues
- npm.io page: https://npm.io/package/memory-cache-decorator

## Dependencies (1)

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

## 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.2.0 (latest) — 2018-04-17
- 1.0.0 — 2017-01-17

## README

## memory-cache-decorator

> :package: Memory cache decorator

## Requirements and Use

```bash
npm install memory-cache-decorator --save
```

### Use
```javascript
import cache from 'memory-cache-decorator';

class Foo {
  constructor() {}

  @cache({ ttl: 2000 })
  getRandomNumber() {
    return Math.random();
  }
}

const bar = new Foo();
bar.getRandomNumber(); //Returns 0.8625773520208384
bar.getRandomNumber(); //Returns 0.8625773520208384

setTimeout(()=> bar.getRandomNumber(), 2000) //Returns 0.7496571644076617
```

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