Storejs

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


License
MIT
Install
bower install Storejs

Documentation

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