imstore

Immutable javascript in-memory store, can also be used as cache

Usage no npm install needed!

<script type="module">
  import imstore from 'https://cdn.skypack.dev/imstore';
</script>

README

ImStore Build Status

Immutable javascript in-memory store

Why?

Because of this

// mutable in-memory store
var store = require('some-mutable-store');

var key = 'xxx';
var value = {a: 'b', cd: [1, 23]};

// save to memory
store.set(key, value);

var getValue = store.get(key);
getValue.a = ['b'];
getValue.cd = [];
getValue.c = 2

console.log(store.get(key));
// {a: ['b'], cd: [], c: 2}
// WHOOPS storage updated itself!

Usage

Install via npm

$ npm install imstore

API is simple and straightforward:

var imstore = require('imstore');
var store = imstore();

// saving value
store.set(key, value);
// or
store.put(key, value);

// get value
store.get(key);

// clear some data
store.delete(key);

// get all available keys
store.keys();

// clear all data in memory
store.clear();
// or
store.flush();
// or
store.reset();

License

MIT