"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NavigationCache = void 0;
class NavigationCache {
    cache = null;
    lastUpdate = 0;
    cacheTimeout;
    constructor(cacheTimeout = 30000) {
        this.cacheTimeout = cacheTimeout;
    }
    get() {
        if (this.cache && Date.now() - this.lastUpdate < this.cacheTimeout) {
            return this.cache;
        }
        return null;
    }
    set(mapping) {
        this.cache = mapping;
        this.lastUpdate = Date.now();
    }
    clear() {
        this.cache = null;
        this.lastUpdate = 0;
    }
    isValid() {
        return this.cache !== null && Date.now() - this.lastUpdate < this.cacheTimeout;
    }
}
exports.NavigationCache = NavigationCache;
//# sourceMappingURL=cache.js.map