# 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

  1. update readme

# 0.0.4.20200803

  1. ncu

# 0.0.3.20200414

  1. set cache
  2. get cache
  3. remove cache
  4. clear cache
  5. add cache and ls

# 0.0.2.20191206

  1. add funding

# 0.0.1.20190624

  1. init project
  2. set item
  3. get item
  4. remove item
  5. modify expires
foo