Node-Cache:轻便的 Node.js 内存缓存

想在 Node.js 应用里轻松使用内存缓存?试试 Node-Cache!

安装简单:

npm install memory-cache --save

使用便捷:

var cache = require('memory-cache');

// 基础用法
cache.put('foo', 'bar');
console.log(cache.get('foo')); // 输出:bar

// 设置过期时间(毫秒)
cache.put('houdini', 'disappear', 100, function(key, value) {
  console.log(key + ' 已 ' + value);
});
zip 文件大小:8.95KB