sp-rest-proxy
Version:
SharePoint REST API Proxy for Node.js and Express local serve
27 lines • 719 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.cache = void 0;
var storage = {};
var cache = (function () {
function cache() {
}
cache.set = function (key, value, ttl) {
var expires = new Date();
expires.setMilliseconds(expires.getMilliseconds() + ttl);
storage[key] = { value: value, expires: expires };
};
cache.get = function (key) {
var s = storage[key];
if (!s) {
return null;
}
if (s.expires < new Date()) {
delete storage[key];
return null;
}
return s.value;
};
return cache;
}());
exports.cache = cache;
//# sourceMappingURL=cache.js.map