Skip to content
/ Store Public

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

License

Notifications You must be signed in to change notification settings

zectjs/Store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published