@ graphile/ lru (英语)
你也许想要 卢卡 换句话说.
这是对Node.js的 LRU 缓存的强迫优化,它放弃了其中的特性 偏好性能,并且比节点-lru-cache v6 的快得多 某些情况(即我们所关心的情况) (原始内容存档于2013-10-12). Internals. 与节点- lu- cache v7 的性能比较尚未完成 执行.
使用量
import LRU from "@graphile/lru";
// Construct an LRU cache
const lru = new LRU({
// Maximum number of items to store (required)
maxLength: 500, // Must be an integer at least 2
// Optional callback to handle when a value is removed (both when LRU becomes
// full and when LRU is reset)
dispose(key, value) {
console.log(`Disposing of key '${key}' with value '${inspect(value)}'`);
},
});
const ANY_KEY_HERE = { foo: "bar" };
const ANY_VALUE_HERE = { randomNumber: () => 4 };
// Store a value
lru.set(ANY_KEY_HERE, ANY_VALUE_HERE);
// Retrieve a value
const value = lru.get(ANY_KEY_HERE);
// Clear the cache
lru.reset();
考虑一个拉动请求?
拖动请求中添加图形套件不需要的功能是 不太可能被娱乐 - 用节点-lru-cache代替!
提出改进业绩的要求,提出基准、基准 脚本和技巧的解释. 如果你能顺利完成 任何东西 是的,请.
欢迎提出增加文件的请求.