1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var CacheMap_1 = require("./CacheMap");
|
4 | var CacheRepo = (function () {
|
5 | function CacheRepo() {
|
6 | var _this = this;
|
7 | this.items = new CacheMap_1.default();
|
8 | this.length = 0;
|
9 | this.get = function (nodeId) { return (_this.items.get(nodeId)); };
|
10 | this.add = function (node) {
|
11 | if (!_this.items.has(node.id)) {
|
12 | _this.items.set(node.id, node);
|
13 | _this.length++;
|
14 | return true;
|
15 | }
|
16 | return false;
|
17 | };
|
18 | this.delete = function (nodeId) {
|
19 | if (_this.items.has(nodeId)) {
|
20 | _this.items.delete(nodeId);
|
21 | _this.length--;
|
22 | }
|
23 | };
|
24 | }
|
25 | return CacheRepo;
|
26 | }());
|
27 | exports.default = CacheRepo;
|