1.1.0 • Published 2 years ago

muc-url-cache v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago
//参数
options:{
  timeout: 2000, //线上下载资源的超时时间
  savePath: '/alidata/wk/cache/', // 存在本地的目录
  max: 200, // lru缓存的最大数量
  ttl: 30 * 60 * 1000, // 默认缓存时间
  updateAgeOnGet:true,
}

//示例
const UrlCache = require('muc-url-cache');
const cache = new UrlCache(options);
const result = await cache.get(url);

//result返回结构
{
  data:'xxxx', //url对应的内容
  from:'cache | file | online'  //内容的来源,内存,文件或者线上
}