store-ex

1.0.0 • Public • Published

Store

Storage Module, the storage encapsulation of localStorage/sessionStorage/Memory, for the consistency interface.

Install

bower install Storejs

Usage

var store = new Store({
  session: true // -> use sessionStorage or local: true->use  localStorage
});

store.set('name', switer);
store.get('name'); // return "switer"
store.remove('name'); // now it's empty

store.set('data', {user: 'switer'}, 60); // store value with expire of 60 seconds

API

instance options:

{
    local: {Boolean},  // use localstorage
    session: {Boolean} // use session storage
    namespace: {String}// use namespace 
}

instance methods:

get(key) getter

set(key, value, expire) setter

remove(key) remove the specify cache with the key

removeExpired() remove all expired cache

Readme

Keywords

none

Package Sidebar

Install

npm i store-ex

Weekly Downloads

1

Version

1.0.0

License

ISC

Last publish

Collaborators

  • switer