store-ex
v1.0.0
Published
LS, Session, Memory
Downloads
2
Readme
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