xl-cache

2.0.3 • Public • Published

xl-cache

nodejs文件缓存模块

使用方法

  • 添加缓存 set(key,value,[duration]);
    duration 过期时常,单位秒,不传或者传0时缓存不过期
cache.set('test1', 'xialei').then(function() {
//设置缓存成功
}).catch(function(e) {
//设置缓存失败
});
  • 读取缓存
    get(key);
cache.get('test1').then(function(data) {
    console.log(data);
}).catch(function(e) {
});
  • 删除缓存
    remove(key);
cache.remove('test').then(function() {
//删除成功
}).catch(function(e) {
//删除失败
});
  • 清空缓存
    clean();
cache.clean().then(function() {
//清空成功
}).catch(function(e) {
//清空失败
});

单元测试

npm run test

Readme

Keywords

Package Sidebar

Install

npm i xl-cache

Weekly Downloads

0

Version

2.0.3

License

MIT

Last publish

Collaborators

  • xialeistudio