ram64
Version:
Multi-threaded 64bit memory cache database inspired by redis-like features
19 lines (18 loc) • 485 B
JavaScript
;
exports.fn = void 0;
var _lru = require("../lru");
const fn = (opts)=>{
const shard = opts.shard;
const obj = shard.map.get(opts.key);
if (obj?.expAt && obj?.expAt <= Date.now()) {
shard.map.delete(opts.key); // remove key if expired
return void 0;
}
if (_lru.isLRUEnabled) {
shard.map.delete(opts.key);
shard.map.set(opts.key, obj);
}
return obj;
};
exports.fn = fn;
//# sourceMappingURL=getWithOptions.js.map