# memory-kv

> Node in Memory Key Value Store similar to Redis

Latest version **0.0.6** (published 2022-08-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install memory-kv
pnpm add memory-kv
yarn add memory-kv
bun add memory-kv
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2022-08-14 |
| First published | 2020-03-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Tharindu Hasthika |
| Maintainers | tharindu96 |
| Keywords | key, value, store, database, memory, kv |

## Links

- npm: https://www.npmjs.com/package/memory-kv
- Repository: https://github.com/tharindu96/node-memory-kv
- Homepage: https://github.com/tharindu96/node-memory-kv#readme
- Issues: https://github.com/tharindu96/node-memory-kv/issues
- npm.io page: https://npm.io/package/memory-kv

## Dependencies (1)

- [micromatch](https://npm.io/package/micromatch.md) ^4.0.5

## Recent versions

- 0.0.6 (latest) — 2022-08-14
- 0.0.5 — 2021-09-21
- 0.0.4 — 2020-09-11
- 0.0.3 — 2020-03-19
- 0.0.2 — 2020-03-10
- 0.0.1 — 2020-03-09

## README

# MemoryKV

An in memory key value store. Tries to emulate Redis inside node itself.

Mainly useful for development purposes.

## Useage

- Typescript
```ts
import MemoryKV from 'memory-kv'

const cache = new MemoryKV();
await cache.set('key1', 'value');

const val = await cache.get('key1');
// val == 'value'
```

- Javascript
```js
const MemoryKV = require('memory-kv');

const cache = new MemoryKV();
await cache.set('key1', 'value');

const val = await cache.get('key1');
// val == 'value'
```

## Features

- [x] Setup a TTL feature
- [x] Set a value with a key
- [x] Get a value with a key
- [x] Delete a value with a key
- [x] Get list of keys provided a pattern

## TTL Strategy

- timeout holder is set to the next execution of the executor with the time it will run
- when a new entry with a ttl is added check if that time is sooner than the timeout, if so cancel the timeout holder and set a new one

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