"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const QuickLru = require("quick-lru");
class LruCache {
    constructor(maxSize) {
        this.lru = new QuickLru({ maxSize });
    }
    get(key, valueFn) {
        const val = this.lru.get(key);
        // speed up by combining .has(key) and .get(key)
        if (val !== undefined) {
            return val;
        }
        const value = valueFn();
        this.lru.set(key, value);
        return value;
    }
}
exports.default = LruCache;
//# sourceMappingURL=lruCache.js.map