3.1.4 • Published 5 years ago
fie-cache v3.1.4
fie-cache
fie 数据缓存模块, 可以用来存储用户常用数据,支持有效期设置
Installation
npm install fie-cache --save
API
get(key)
获取缓存内容,如果不存在或已过期则返回 null
- key
{string}
缓存的键值 - return:
{mix}
缓存内容
set(key, value, options)
设置缓存
- key
{string}
缓存键值 - value
{mix}
缓存内容,可以为字符串,数字或json对象 - options
{object}
- options.expires
{number}
缓存时间,毫秒为单位,如: 1小时 => 3600000
clear
清除所有缓存
例子
const cache = require('fie-cache');
// 将abc这个key的对象写入fie缓存文件。(该缓存文件一般在 ~/.fie/fie.cache.json 中)
cache.set('abc',{ data : 1 });
// 从fie缓存中获取 abc 这个key的内容。
cache.get('abc');
// => return { data : 1 }
//清空fie的缓存内容
cache.clear();
Support
使用过程中遇到的相关问题,及BUG反馈,可联系: hugohua baofen14787@gmail.com ,也可直接提issues
License
3.1.8-alpha.0
5 years ago
3.1.4
5 years ago
3.1.3
6 years ago
3.1.3-0
6 years ago
3.1.2
6 years ago
3.0.1
7 years ago
3.0.0
7 years ago
2.7.10
7 years ago
2.7.9
7 years ago
2.7.8
7 years ago
2.7.7
7 years ago
2.7.4
7 years ago
2.7.3
7 years ago
1.3.7
7 years ago
1.3.5
7 years ago
1.3.3
7 years ago
1.3.2
7 years ago
1.3.1
7 years ago
1.3.0
7 years ago
1.1.0
7 years ago