Socket
Socket
Sign inDemoInstall

imstore

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imstore

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


Version published
Maintainers
1
Created
Source

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

Keywords

FAQs

Package last updated on 11 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc