@naturalcycles/nodejs-lib
Version:
Standard library for Node.js
29 lines • 597 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const LRUCache = require("lru-cache");
/**
* @example
* Use it like this:
*
* @memo({ cacheFactory: () => new LRUMemoCache({...}) })
* method1 ()
*/
class LRUMemoCache {
constructor(opt) {
this.lru = new LRUCache(opt);
}
has(k) {
return this.lru.has(k);
}
get(k) {
return this.lru.get(k);
}
set(k, v) {
this.lru.set(k, v);
}
clear() {
this.lru.reset();
}
}
exports.LRUMemoCache = LRUMemoCache;
//# sourceMappingURL=lruMemoCache.js.map