# promise-async-cache

> promise-async-cache

Latest version **1.0.0** (published 2015-07-27) · 0 weekly downloads

## Install

```sh
npm install promise-async-cache
pnpm add promise-async-cache
yarn add promise-async-cache
bun add promise-async-cache
```

## 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.0.0 |
| Published | 2015-07-27 |
| First published | 2015-07-27 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Max Claus Nunes |
| Maintainers | maxcnunes |
| Keywords | promise, async, cache |

## Links

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

## Dependencies (1)

- [debug](https://npm.io/package/debug.md) ^2.2.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.0.0 (latest) — 2015-07-27

## README

# promise-async-cache

[![Build Status](https://travis-ci.org/maxcnunes/promise-async-cache.svg?branch=master)](https://travis-ci.org/maxcnunes/promise-async-cache)
[![npm version](https://badge.fury.io/js/promise-async-cache.svg)](http://badge.fury.io/js/promise-async-cache)

> Thanks [@esnunes](https://github.com/esnunes) for the initial implementation :)

## Installation

Install via npm:

```bash
$ npm install promise-async-cache
```

## Usage

```js
// the example uses es6 but it works with es5 as well
import PromiseAsyncCache from 'promise-async-cache';

// loading value into the cache
const cache = new PromiseAsyncCache({
  load (key) {
    // load async data
    // then return a promise with the value to be cached
  }
});

// getting value from the cache
cache.get(key).then(value => /* ... */);
```

### Extra arguments

Is possible passing extra arguments to the `load` function through the `get` function:

```js
const cache = new PromiseAsyncCache({
  load (key, myOtherObject) { /* ... */ }
});

cache.get(key, myOtherObject).then(value => /* ... */);
```

It is required to use [editorconfig](http://editorconfig.org/) and please write and run specs before pushing any changes:

```js
npm test
```

## License

Copyright (c) 2015 Max Claus Nunes. This software is licensed under the [MIT License](http://raw.github.com/maxcnunes/promise-async-cache/master/LICENSE).

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