yach.util.localstorage
v0.0.10
Published
local storage expires
Downloads
1
Readme
yach.util.localstorage
基于localstorage的二次封装
安装
$ npm i yach.util.localstorage
使用
// setItem
var qls = require('yach.util.localstorage');
var test = function(){
var name = 'name';
var value = 'value';
qls.setItem(name, value);
var expires = 1;
qls.setItem(name, value, expires);
};
// getItem
var qls = require('yach.util.localstorage');
var test = function(){
var name = 'name';
var value = qls.getItem(name);
console.log(value);
};
test();
// removeItem
var qls = require('yach.util.localstorage');
var test = function(){
var name = 'name';
qls.removeItem(name);
var value = qls.getItem(name);
console.log(value);
};
test();
// ls
var qls = require('yach.util.localstorage');
var test = function(){
// set
qls.ls('name', 'value');
// get
console.log(qls.ls('name'));
// delete
qls.ls('name', null);
console.log(qls.ls('name'));
};
test();
// setCache
var qls = require('yach.util.localstorage');
qls.setCache('cache.group.role', 'team-123', false);
qls.setCache('cache.group.role', 'team-123', true);
// getCache
var qls = require('yach.util.localstorage');
console.log(qls.getCache('cache.group.role', 'team-123'));
// removeCache
var qls = require('yach.util.localstorage');
qls.removeCache('cache.group.role', 'team-123');
// clearCache
var qls = require('yach.util.localstorage');
qls.clearCache('cache.group.role');
// cache
var qls = require('yach.util.localstorage');
var test = function(){
// set
qls.cache('name', 'key', 'value');
// get
console.log(qls.cache('name', 'key'));
// delete
qls.cache('name', 'key', null);
console.log(qls.cache('name', 'key'));
// clear
qls.cache('name', null);
};
test();
version
0.0.10.20200908
- update readme
0.0.4.20200803
- ncu
0.0.3.20200414
- set cache
- get cache
- remove cache
- clear cache
- add cache and ls
0.0.2.20191206
- add funding
0.0.1.20190624
- init project
- set item
- get item
- remove item
- modify expires