# map-cachedfifo

> FIFO Cached interface for a Promised Map.

Latest version **0.0.14** (published 2017-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install map-cachedfifo
pnpm add map-cachedfifo
yarn add map-cachedfifo
bun add map-cachedfifo
```

## 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.0.14 |
| Published | 2017-09-11 |
| First published | 2017-08-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | wolfram77@gmail.com |
| Maintainers | wolfram77 |
| Keywords | map, cached, fifo |

## Links

- npm: https://www.npmjs.com/package/map-cachedfifo
- Repository: https://github.com/wolfram77/node-mapcachedfifo
- Homepage: https://github.com/wolfram77/node-mapcachedfifo#readme
- Issues: https://github.com/wolfram77/node-mapcachedfifo/issues
- npm.io page: https://npm.io/package/map-cachedfifo

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

- 0.0.14 (latest) — 2017-09-11
- 0.0.13 — 2017-09-11
- 0.0.12 — 2017-09-11
- 0.0.11 — 2017-09-11
- 0.0.10 — 2017-09-11
- 0.0.9 — 2017-09-11
- 0.0.8 — 2017-09-11
- 0.0.7 — 2017-08-25
- 0.0.6 — 2017-08-24
- 0.0.2 — 2017-08-23
- 0.0.1 — 2017-08-23
- 0.0.0 — 2017-08-23

## README

# map-cachedfifo

[![NPM](https://nodei.co/npm/map-cachedfifo.png)](https://nodei.co/npm/map-cachedfifo/)

FIFO Cached interface for a Promised Map.

```javascript
var MapCachedFifo = require('map-cachedfifo');
// MapCachedFifo(<source>, [<cache>], [<evict>])
// source: a promised map, like MapPg (map-pg)
// cache:  size of get and set cache, evicts and flushes when full (default 1024)
// evict:  fraction of get cache to evict when full (default 0.5)
```
```javascript
var MapPromised = require('map-promised');
var MapCachedFifo = require('map-cachedfifo');

var mapp = new MapPromised(new Map());
var mapc = new MapCachedFifo(mapp);
mapp.setup().then(() => {
  mapp.set('a', 1);
}).then(() => {
  // MapCachedFifo has no setup()
  mapc._num;                        // number of pairs in cache
  mapc._map;                        // cached items
  mapc._map.size;                   // number of items in cache, including deleted pairs
  mapc.set('b', 2);
  mapc.size.then((ans) => ans);     // 2
  mapc.get('b').then((ans) => ans); // 2
  mapc.get('a').then((ans) => ans); // 1
  mapc.delete('b');
  mapc.size.then((ans) => ans);     // 1
  mapc.set('c', 3);
  mapc.set('d', 4);
  mapc._num                         // <=2
  mapc.size.then((ans) => ans);     // 3
  mapc.flush().then(() => {
    return mapp.size;
  }).then((ans) => ans);            // 3
  // ...
});
```

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