@ercworldio/blockchain-shared 1.0.3-dev.4-PROJ-1296.7 → 1.0.3-dev.4-PROJ-1296.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncTTLCache.d.ts","sourceRoot":"","sources":["../../src/utils/AsyncTTLCache.ts"],"names":[],"mappings":"AAOA,cAAM,aAAa;IACf,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC;IAC/B,OAAO,CAAC,QAAQ,CAAwC;IAEjD,aAAa,EAAE,MAAM,CAAC;IAE7B,OAAO,CAAC,KAAK,CAAmB;IAEhC,OAAO;IAKP,MAAM,CAAC,WAAW;IAQlB,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,GAAG,aAAa;YAQxC,gBAAgB;IAUvB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"AsyncTTLCache.d.ts","sourceRoot":"","sources":["../../src/utils/AsyncTTLCache.ts"],"names":[],"mappings":"AAOA,cAAM,aAAa;IACf,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC;IAC/B,OAAO,CAAC,QAAQ,CAAwC;IAEjD,aAAa,EAAE,MAAM,CAAC;IAE7B,OAAO,CAAC,KAAK,CAAmB;IAEhC,OAAO;IAKP,MAAM,CAAC,WAAW;IAQlB,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,GAAG,aAAa;YAQxC,gBAAgB;IAUvB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAW7B,cAAc,IAAI,IAAI;IAKhB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC;CAmCzF;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -40,8 +40,14 @@ class AsyncTTLCache {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
invalidate(key) {
|
|
43
|
+
console.log(`Invalidating key ${key}`);
|
|
44
|
+
const existing = this.cache.get(key);
|
|
45
|
+
console.log(`Existing record found : `, existing);
|
|
43
46
|
this.cache.delete(key);
|
|
44
47
|
this.inflight.delete(key);
|
|
48
|
+
console.log(`Deeleted cache for key ${key}`);
|
|
49
|
+
const afterDelete = this.cache.get(key);
|
|
50
|
+
console.log(`After delete key: ${key}`, afterDelete);
|
|
45
51
|
}
|
|
46
52
|
invalidate_all() {
|
|
47
53
|
this.cache.clear();
|
|
@@ -49,11 +55,13 @@ class AsyncTTLCache {
|
|
|
49
55
|
}
|
|
50
56
|
get_value(key, data, fetch_task) {
|
|
51
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
console.log(`Getting value from AsynTTLCache for key ${key}`);
|
|
52
59
|
let existing_entry = this.cache.get(key);
|
|
60
|
+
console.log(`Existing entry:`, existing_entry);
|
|
53
61
|
let now = new Date().getTime();
|
|
54
62
|
// Return cached value
|
|
55
63
|
if (existing_entry && now - existing_entry.last_update <= this.stale_time_ms) {
|
|
56
|
-
console.log(`AsyncTTLCache: Hitting cache... KEY: ${key}, Value:`, existing_entry
|
|
64
|
+
console.log(`AsyncTTLCache: Hitting cache... KEY: ${key}, Value:`, existing_entry);
|
|
57
65
|
return existing_entry.value;
|
|
58
66
|
}
|
|
59
67
|
if (!existing_entry || now - existing_entry.last_update > this.stale_time_ms) {
|
|
@@ -72,7 +80,7 @@ class AsyncTTLCache {
|
|
|
72
80
|
this.inflight.delete(key);
|
|
73
81
|
}
|
|
74
82
|
}
|
|
75
|
-
console.log(`AsyncTTLCache: Hitting cache... Value:`, existing_entry
|
|
83
|
+
console.log(`AsyncTTLCache: Hitting cache... Value:`, existing_entry);
|
|
76
84
|
return existing_entry.value;
|
|
77
85
|
});
|
|
78
86
|
}
|
package/package.json
CHANGED