# map-expire

> Extended Map object with capacity and expire

Latest version **1.0.2** (published 2021-02-11) · ISC license · 0 weekly downloads

## Install

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

## 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.2 |
| Published | 2021-02-11 |
| First published | 2017-03-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.20.0 |
| Dependencies | 0 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Cavit Keskin |
| Maintainers | cavitkeskin |
| Keywords | map, expire, capacity, cache, memory, key, value |

## Links

- npm: https://www.npmjs.com/package/map-expire
- Repository: https://github.com/cavitkeskin/map-expire
- Homepage: https://github.com/cavitkeskin/map-expire#readme
- Issues: https://github.com/cavitkeskin/map-expire/issues
- npm.io page: https://npm.io/package/map-expire

## 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.2 (latest) — 2021-02-11
- 1.0.1 — 2021-01-03
- 1.0.0 — 2021-01-02
- 0.0.6 — 2020-03-13
- 0.0.5 — 2020-03-10
- 0.0.3 — 2017-03-15
- 0.0.2 — 2017-03-02
- 0.0.1 — 2017-03-02

## README

# map-expire

Extended Map object with capacity and expire features

## install


```sh
npm install --save map-expire
```

## usage

```javascript

const cache = require('map-expire');

cache.set(key, value, duration)

const value = cache.get(key)
cache.delete(key)
```

or

```js
const MapExpire = require('map-expire/MapExpire');
const options = {
	capacity: 100, 
	duration: 1000 // in millisecond, default expiration time
}
const cache = new MapExpire([], options)

cache.set(key, value, duration)
const value = cache.get(key)
cache.delete(key)
```

## API

- set(key, value, duration)

	duration will be set to default value if not given.

- get(key)
	returns with undefined if not exists or expired

## test

```sh
npm test
```

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