@clickup/ent-framework
Version:
A PostgreSQL graph-database-alike library with microsharding and row-level security
25 lines • 846 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.IDsCache = void 0;
const quick_lru_1 = __importDefault(require("quick-lru"));
const objectId_1 = require("../internal/objectId");
const SEP = ":";
class IDsCache {
constructor() {
this.ids = new quick_lru_1.default({ maxSize: 2000 });
}
has(Ent, id) {
return this.ids.has((0, objectId_1.objectId)(Ent) + SEP + id);
}
add(Ent, id, value = true) {
this.ids.set((0, objectId_1.objectId)(Ent) + SEP + id, value);
}
get(Ent, id) {
return this.ids.get((0, objectId_1.objectId)(Ent) + SEP + id);
}
}
exports.IDsCache = IDsCache;
//# sourceMappingURL=IDsCache.js.map