【文件属性】:
文件名称:node-lru:nodejs实现的lru缓存
文件大小:3KB
文件格式:ZIP
更新时间:2021-07-10 21:10:23
JavaScript
Node LRU Cache
基于Nodejs开发的LRU Cache, 兼有缓存超时清除功能
usage
var options = {
expires: 5 * 60 * 1000,
capacity: 5
};
var LRU = require('node-lru');
var cache = new LRU(2);//var cache = new LRU(options);
cache.set('key1', 'value1');
cache.set('key2', 'value2');
cache.set('key3', 'value3');
var value = cache.get('key2');
cache.on('extrusion', function (tail) {
console.log(tail.key + ": " + tail.value)
【文件预览】:
node-lru-master
----.gitignore(25B)
----package.json(689B)
----README.md(724B)
----lib()
--------lru.js(3KB)
----test()
--------test-lru.js(3KB)