@static-suite/static-suite-data-server 0.0.5 → 0.0.6
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":"cacheBinManager.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/cache/cacheBinManager.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAE/C,oBAAY,KAAK,GAAG;IAClB;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;;;OAMG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAE5B;;;;OAIG;IACH,IAAI,IAAI,MAAM,EAAE,CAAC;IAEjB;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;
|
|
1
|
+
{"version":3,"file":"cacheBinManager.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/cache/cacheBinManager.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAE/C,oBAAY,KAAK,GAAG;IAClB;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEzC;;;;;;OAMG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAE5B;;;;OAIG;IACH,IAAI,IAAI,MAAM,EAAE,CAAC;IAEjB;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAgCF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KA8BnB,CAAC"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cache = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Keeps a list of consumed bins to be able to clear them later.
|
|
6
|
+
*
|
|
7
|
+
* "data" is a Map and its bins can be removed, but those bins are
|
|
8
|
+
* Maps at the same time. That leads to having bin objects used by
|
|
9
|
+
* some module that cannot be cleared when Cache::clear() runs.
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
const consumedBins = new Map();
|
|
4
13
|
const data = new Map();
|
|
5
14
|
/**
|
|
6
15
|
* Initializes a cache bin.
|
|
@@ -14,7 +23,9 @@ const data = new Map();
|
|
|
14
23
|
*
|
|
15
24
|
*/
|
|
16
25
|
const initBin = (binId) => {
|
|
17
|
-
|
|
26
|
+
const bin = new Map();
|
|
27
|
+
data.set(binId, bin);
|
|
28
|
+
consumedBins.set(binId, bin);
|
|
18
29
|
return data.get(binId);
|
|
19
30
|
};
|
|
20
31
|
/**
|
|
@@ -46,8 +57,8 @@ exports.cache = {
|
|
|
46
57
|
* Deletes all available cache bins.
|
|
47
58
|
*/
|
|
48
59
|
clear: () => {
|
|
49
|
-
|
|
50
|
-
|
|
60
|
+
consumedBins.forEach(bin => {
|
|
61
|
+
bin.clear();
|
|
51
62
|
});
|
|
52
63
|
data.clear();
|
|
53
64
|
},
|
package/package.json
CHANGED
|
@@ -31,6 +31,16 @@ export type Cache = {
|
|
|
31
31
|
clear(): void;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Keeps a list of consumed bins to be able to clear them later.
|
|
36
|
+
*
|
|
37
|
+
* "data" is a Map and its bins can be removed, but those bins are
|
|
38
|
+
* Maps at the same time. That leads to having bin objects used by
|
|
39
|
+
* some module that cannot be cleared when Cache::clear() runs.
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
const consumedBins = new Map<string, CacheBin<any>>();
|
|
43
|
+
|
|
34
44
|
const data = new Map<string, CacheBin<any>>();
|
|
35
45
|
|
|
36
46
|
/**
|
|
@@ -45,7 +55,9 @@ const data = new Map<string, CacheBin<any>>();
|
|
|
45
55
|
*
|
|
46
56
|
*/
|
|
47
57
|
const initBin = <Type>(binId: string): CacheBin<Type> => {
|
|
48
|
-
|
|
58
|
+
const bin = new Map<string, Type>();
|
|
59
|
+
data.set(binId, bin);
|
|
60
|
+
consumedBins.set(binId, bin);
|
|
49
61
|
return data.get(binId) as CacheBin<Type>;
|
|
50
62
|
};
|
|
51
63
|
|
|
@@ -81,8 +93,8 @@ export const cache: Cache = {
|
|
|
81
93
|
* Deletes all available cache bins.
|
|
82
94
|
*/
|
|
83
95
|
clear: () => {
|
|
84
|
-
|
|
85
|
-
|
|
96
|
+
consumedBins.forEach(bin => {
|
|
97
|
+
bin.clear();
|
|
86
98
|
});
|
|
87
99
|
data.clear();
|
|
88
100
|
},
|