0.0.6 • Published 2 years ago

memory-kv v0.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

MemoryKV

An in memory key value store. Tries to emulate Redis inside node itself.

Mainly useful for development purposes.

Useage

  • Typescript
import MemoryKV from 'memory-kv'

const cache = new MemoryKV();
await cache.set('key1', 'value');

const val = await cache.get('key1');
// val == 'value'
  • Javascript
const MemoryKV = require('memory-kv');

const cache = new MemoryKV();
await cache.set('key1', 'value');

const val = await cache.get('key1');
// val == 'value'

Features

  • Setup a TTL feature
  • Set a value with a key
  • Get a value with a key
  • Delete a value with a key
  • 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
0.0.6

2 years ago

0.0.5

3 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago