imstore

0.1.2 • Public • Published

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

Package Sidebar

Install

npm i imstore

Weekly Downloads

1

Version

0.1.2

License

MIT

Last publish

Collaborators

  • pveyes