@gvnrdao/dh-sdk 0.0.291 → 0.0.293
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.
- package/browser/dist/browser.js +1 -1
- package/dist/index.js +57 -321
- package/dist/index.mjs +57 -321
- package/dist/modules/bitcoin/bitcoin-operations.module.d.ts +10 -2
- package/dist/modules/cache/cache-manager.module.d.ts +41 -208
- package/dist/modules/diamond-hands-sdk.d.ts +5 -1
- package/dist/modules/loan/loan-query.module.d.ts +5 -1
- package/dist/modules/pkp/pkp-manager.module.d.ts +5 -1
- package/package.json +1 -1
- package/browser/dist/833.browser.js +0 -2
- package/browser/dist/833.browser.js.LICENSE.txt +0 -1
package/dist/index.js
CHANGED
|
@@ -3744,7 +3744,7 @@ var require_abstract_coder = __commonJS({
|
|
|
3744
3744
|
function toObject2(names2, items, deep) {
|
|
3745
3745
|
if (names2.indexOf(null) >= 0) {
|
|
3746
3746
|
return items.map((item, index) => {
|
|
3747
|
-
if (item instanceof
|
|
3747
|
+
if (item instanceof Result10) {
|
|
3748
3748
|
return toObject2(getNames2(item), item, deep);
|
|
3749
3749
|
}
|
|
3750
3750
|
return item;
|
|
@@ -3753,7 +3753,7 @@ var require_abstract_coder = __commonJS({
|
|
|
3753
3753
|
return names2.reduce((accum, name, index) => {
|
|
3754
3754
|
let item = items.getValue(name);
|
|
3755
3755
|
if (!(name in accum)) {
|
|
3756
|
-
if (deep && item instanceof
|
|
3756
|
+
if (deep && item instanceof Result10) {
|
|
3757
3757
|
item = toObject2(getNames2(item), item, deep);
|
|
3758
3758
|
}
|
|
3759
3759
|
accum[name] = item;
|
|
@@ -3761,7 +3761,7 @@ var require_abstract_coder = __commonJS({
|
|
|
3761
3761
|
return accum;
|
|
3762
3762
|
}, {});
|
|
3763
3763
|
}
|
|
3764
|
-
var
|
|
3764
|
+
var Result10 = class _Result extends Array {
|
|
3765
3765
|
// No longer used; but cannot be removed as it will remove the
|
|
3766
3766
|
// #private field from the .d.ts which may break backwards
|
|
3767
3767
|
// compatibility
|
|
@@ -3965,7 +3965,7 @@ var require_abstract_coder = __commonJS({
|
|
|
3965
3965
|
return new _Result(_guard5, items, keys);
|
|
3966
3966
|
}
|
|
3967
3967
|
};
|
|
3968
|
-
exports2.Result =
|
|
3968
|
+
exports2.Result = Result10;
|
|
3969
3969
|
function checkResultErrors2(result) {
|
|
3970
3970
|
const errors2 = [];
|
|
3971
3971
|
const checkErrors = function(path2, object2) {
|
|
@@ -34943,8 +34943,8 @@ function getMainnetConfig() {
|
|
|
34943
34943
|
bitcoinWithdrawalAddressRegistry: MAINNET_CONTRACTS.BitcoinWithdrawalAddressRegistry || ""
|
|
34944
34944
|
},
|
|
34945
34945
|
subgraphs: {
|
|
34946
|
-
diamondHandsUrl: "https://
|
|
34947
|
-
//
|
|
34946
|
+
diamondHandsUrl: "https://api.studio.thegraph.com/query/1755201/diamond-hands/v1.0.0-mainnet"
|
|
34947
|
+
// Mainnet subgraph (keyless studio endpoint, browser-queryable)
|
|
34948
34948
|
},
|
|
34949
34949
|
litNetwork: "chipotle",
|
|
34950
34950
|
debug: false
|
|
@@ -90299,7 +90299,7 @@ __export(src_exports, {
|
|
|
90299
90299
|
ErrorSeverity: () => ErrorSeverity,
|
|
90300
90300
|
EventHelpers: () => EventHelpers,
|
|
90301
90301
|
LOCALHOST_CONTRACTS: () => LOCALHOST_CONTRACTS,
|
|
90302
|
-
LRUCache: () =>
|
|
90302
|
+
LRUCache: () => Cache,
|
|
90303
90303
|
LoanCreator: () => LoanCreator,
|
|
90304
90304
|
LoanQuery: () => LoanQuery,
|
|
90305
90305
|
LoanStatus: () => LoanStatus,
|
|
@@ -109823,365 +109823,106 @@ function createContractManager(config) {
|
|
|
109823
109823
|
}
|
|
109824
109824
|
|
|
109825
109825
|
// src/modules/cache/cache-manager.module.ts
|
|
109826
|
-
var
|
|
109827
|
-
cache;
|
|
109828
|
-
/**
|
|
109829
|
-
* Audit M-J: singleflight registry for `getOrCompute` / `getOrComputeResult`.
|
|
109830
|
-
* Concurrent cache-miss callers for the same key share one inflight promise
|
|
109831
|
-
* instead of each running `compute()` independently — important when the
|
|
109832
|
-
* compute spends a paid LIT capacity credit or hits a rate-limited upstream.
|
|
109833
|
-
*/
|
|
109834
|
-
inflight = /* @__PURE__ */ new Map();
|
|
109835
|
-
inflightResult = /* @__PURE__ */ new Map();
|
|
109826
|
+
var Cache = class {
|
|
109827
|
+
cache = /* @__PURE__ */ new Map();
|
|
109836
109828
|
maxSize;
|
|
109837
109829
|
ttlMs;
|
|
109838
|
-
|
|
109839
|
-
|
|
109840
|
-
|
|
109841
|
-
stats = {
|
|
109842
|
-
hits: 0,
|
|
109843
|
-
misses: 0,
|
|
109844
|
-
evictions: 0
|
|
109845
|
-
};
|
|
109846
|
-
constructor(config = {}) {
|
|
109847
|
-
this.cache = /* @__PURE__ */ new Map();
|
|
109848
|
-
this.maxSize = config.maxSize || 1e3;
|
|
109849
|
-
this.ttlMs = config.ttlMs || 6e4;
|
|
109850
|
-
this.debug = config.debug || false;
|
|
109851
|
-
this.name = config.name || "Cache";
|
|
109852
|
-
if (this.debug) {
|
|
109853
|
-
console.log(
|
|
109854
|
-
`\u{1F4BE} [${this.name}] Initialized: maxSize=${this.maxSize}, ttl=${this.ttlMs}ms`
|
|
109855
|
-
);
|
|
109856
|
-
}
|
|
109830
|
+
constructor(config) {
|
|
109831
|
+
this.maxSize = config.maxSize;
|
|
109832
|
+
this.ttlMs = config.ttlMs;
|
|
109857
109833
|
}
|
|
109858
109834
|
/**
|
|
109859
109835
|
* Get value from cache
|
|
109860
|
-
*
|
|
109861
|
-
* Returns null if:
|
|
109862
|
-
* - Key not found
|
|
109863
|
-
* - Entry has expired
|
|
109864
|
-
*
|
|
109865
|
-
* @param key - Cache key
|
|
109866
|
-
* @returns Cached value or null
|
|
109867
109836
|
*/
|
|
109868
109837
|
get(key) {
|
|
109869
109838
|
const entry = this.cache.get(key);
|
|
109870
109839
|
if (!entry) {
|
|
109871
|
-
|
|
109872
|
-
if (this.debug) {
|
|
109873
|
-
console.log(`\u274C [${this.name}] Cache MISS: ${String(key)}`);
|
|
109874
|
-
}
|
|
109875
|
-
return null;
|
|
109840
|
+
return void 0;
|
|
109876
109841
|
}
|
|
109877
|
-
|
|
109842
|
+
const now = Date.now();
|
|
109843
|
+
if (now - entry.timestamp > entry.ttl) {
|
|
109878
109844
|
this.cache.delete(key);
|
|
109879
|
-
|
|
109880
|
-
if (this.debug) {
|
|
109881
|
-
const age = Date.now() - entry.timestamp;
|
|
109882
|
-
console.log(`\u23F0 [${this.name}] Cache EXPIRED: ${String(key)} (age: ${age}ms)`);
|
|
109883
|
-
}
|
|
109884
|
-
return null;
|
|
109885
|
-
}
|
|
109886
|
-
entry.hits++;
|
|
109887
|
-
entry.lastAccessed = Date.now();
|
|
109888
|
-
this.cache.set(key, entry);
|
|
109889
|
-
this.stats.hits++;
|
|
109890
|
-
if (this.debug) {
|
|
109891
|
-
const age = Date.now() - entry.timestamp;
|
|
109892
|
-
console.log(
|
|
109893
|
-
`\u2705 [${this.name}] Cache HIT: ${String(key)} (age: ${age}ms, hits: ${entry.hits})`
|
|
109894
|
-
);
|
|
109845
|
+
return void 0;
|
|
109895
109846
|
}
|
|
109896
109847
|
return entry.value;
|
|
109897
109848
|
}
|
|
109898
|
-
/**
|
|
109899
|
-
* Get value from cache with Result wrapper
|
|
109900
|
-
*
|
|
109901
|
-
* Useful when you want to distinguish between "not found" and "expired"
|
|
109902
|
-
*/
|
|
109903
|
-
getResult(key) {
|
|
109904
|
-
const value = this.get(key);
|
|
109905
|
-
if (value === null) {
|
|
109906
|
-
return failure(
|
|
109907
|
-
new SDKError({
|
|
109908
|
-
message: `Cache miss for key: ${String(key)}`,
|
|
109909
|
-
category: "CACHE" /* CACHE */,
|
|
109910
|
-
severity: "LOW" /* LOW */,
|
|
109911
|
-
originalError: new Error("Cache miss")
|
|
109912
|
-
})
|
|
109913
|
-
);
|
|
109914
|
-
}
|
|
109915
|
-
return success(value);
|
|
109916
|
-
}
|
|
109917
109849
|
/**
|
|
109918
109850
|
* Set value in cache
|
|
109919
|
-
*
|
|
109920
|
-
* If cache is full, evicts the least recently used entry
|
|
109921
|
-
*
|
|
109922
|
-
* @param key - Cache key
|
|
109923
|
-
* @param value - Value to cache
|
|
109924
|
-
* @param ttl - Optional custom TTL for this entry (ms)
|
|
109925
109851
|
*/
|
|
109926
109852
|
set(key, value, ttl) {
|
|
109927
109853
|
if (this.cache.size >= this.maxSize && !this.cache.has(key)) {
|
|
109928
|
-
this.
|
|
109854
|
+
const firstKey = this.cache.keys().next().value;
|
|
109855
|
+
if (firstKey) {
|
|
109856
|
+
this.cache.delete(firstKey);
|
|
109857
|
+
}
|
|
109929
109858
|
}
|
|
109930
|
-
|
|
109859
|
+
this.cache.set(key, {
|
|
109931
109860
|
value,
|
|
109932
109861
|
timestamp: Date.now(),
|
|
109933
|
-
|
|
109934
|
-
|
|
109935
|
-
};
|
|
109936
|
-
this.cache.set(key, entry);
|
|
109937
|
-
if (this.debug) {
|
|
109938
|
-
const effectiveTtl = ttl || this.ttlMs;
|
|
109939
|
-
console.log(
|
|
109940
|
-
`\u{1F4BE} [${this.name}] Cache SET: ${String(key)} (ttl: ${effectiveTtl}ms, size: ${this.cache.size}/${this.maxSize})`
|
|
109941
|
-
);
|
|
109942
|
-
}
|
|
109943
|
-
}
|
|
109944
|
-
/**
|
|
109945
|
-
* Set value in cache with Result wrapper
|
|
109946
|
-
*/
|
|
109947
|
-
setResult(key, value, ttl) {
|
|
109948
|
-
try {
|
|
109949
|
-
this.set(key, value, ttl);
|
|
109950
|
-
return success(void 0);
|
|
109951
|
-
} catch (error2) {
|
|
109952
|
-
return failure(
|
|
109953
|
-
new SDKError({
|
|
109954
|
-
message: `Failed to set cache value for key: ${String(key)}`,
|
|
109955
|
-
category: "CACHE" /* CACHE */,
|
|
109956
|
-
severity: "MEDIUM" /* MEDIUM */,
|
|
109957
|
-
originalError: error2 instanceof Error ? error2 : new Error(String(error2))
|
|
109958
|
-
})
|
|
109959
|
-
);
|
|
109960
|
-
}
|
|
109862
|
+
ttl: ttl || this.ttlMs
|
|
109863
|
+
});
|
|
109961
109864
|
}
|
|
109962
109865
|
/**
|
|
109963
|
-
* Check if key exists in cache
|
|
109866
|
+
* Check if key exists in cache
|
|
109964
109867
|
*/
|
|
109965
109868
|
has(key) {
|
|
109966
|
-
|
|
109967
|
-
return entry !== void 0 && !this.isExpired(entry);
|
|
109869
|
+
return this.get(key) !== void 0;
|
|
109968
109870
|
}
|
|
109969
109871
|
/**
|
|
109970
|
-
* Delete
|
|
109872
|
+
* Delete key from cache
|
|
109971
109873
|
*/
|
|
109972
109874
|
delete(key) {
|
|
109973
|
-
|
|
109974
|
-
if (deleted && this.debug) {
|
|
109975
|
-
console.log(`\u{1F5D1}\uFE0F [${this.name}] Cache DELETE: ${String(key)}`);
|
|
109976
|
-
}
|
|
109977
|
-
return deleted;
|
|
109875
|
+
return this.cache.delete(key);
|
|
109978
109876
|
}
|
|
109979
109877
|
/**
|
|
109980
|
-
* Clear
|
|
109878
|
+
* Clear all cache entries
|
|
109981
109879
|
*/
|
|
109982
109880
|
clear() {
|
|
109983
|
-
const previousSize = this.cache.size;
|
|
109984
109881
|
this.cache.clear();
|
|
109985
|
-
this.stats = {
|
|
109986
|
-
hits: 0,
|
|
109987
|
-
misses: 0,
|
|
109988
|
-
evictions: 0
|
|
109989
|
-
};
|
|
109990
|
-
if (this.debug) {
|
|
109991
|
-
console.log(`\u{1F9F9} [${this.name}] Cache CLEARED: removed ${previousSize} entries`);
|
|
109992
|
-
}
|
|
109993
|
-
}
|
|
109994
|
-
/**
|
|
109995
|
-
* Get current cache size
|
|
109996
|
-
*/
|
|
109997
|
-
size() {
|
|
109998
|
-
return this.cache.size;
|
|
109999
|
-
}
|
|
110000
|
-
/**
|
|
110001
|
-
* Get cache statistics
|
|
110002
|
-
*/
|
|
110003
|
-
getStats() {
|
|
110004
|
-
const entries = Array.from(this.cache.values());
|
|
110005
|
-
const timestamps = entries.map((e) => e.timestamp);
|
|
110006
|
-
const total = this.stats.hits + this.stats.misses;
|
|
110007
|
-
const hitRate = total === 0 ? 0 : this.stats.hits / total * 100;
|
|
110008
|
-
return {
|
|
110009
|
-
size: this.cache.size,
|
|
110010
|
-
hits: this.stats.hits,
|
|
110011
|
-
misses: this.stats.misses,
|
|
110012
|
-
evictions: this.stats.evictions,
|
|
110013
|
-
oldestEntry: timestamps.length > 0 ? Math.min(...timestamps) : 0,
|
|
110014
|
-
newestEntry: timestamps.length > 0 ? Math.max(...timestamps) : 0,
|
|
110015
|
-
hitRate
|
|
110016
|
-
};
|
|
110017
109882
|
}
|
|
110018
109883
|
/**
|
|
110019
|
-
*
|
|
110020
|
-
*/
|
|
110021
|
-
getHitRate() {
|
|
110022
|
-
const total = this.stats.hits + this.stats.misses;
|
|
110023
|
-
return total === 0 ? 0 : this.stats.hits / total * 100;
|
|
110024
|
-
}
|
|
110025
|
-
/**
|
|
110026
|
-
* Get all cached keys (for debugging)
|
|
110027
|
-
*/
|
|
110028
|
-
getKeys() {
|
|
110029
|
-
return Array.from(this.cache.keys());
|
|
110030
|
-
}
|
|
110031
|
-
/**
|
|
110032
|
-
* Get all cached values (for debugging)
|
|
110033
|
-
*/
|
|
110034
|
-
getValues() {
|
|
110035
|
-
return Array.from(this.cache.values()).map((entry) => entry.value);
|
|
110036
|
-
}
|
|
110037
|
-
/**
|
|
110038
|
-
* Get all cache entries with metadata (for debugging)
|
|
110039
|
-
*/
|
|
110040
|
-
getEntries() {
|
|
110041
|
-
return Array.from(this.cache.entries()).map(([key, entry]) => ({
|
|
110042
|
-
key,
|
|
110043
|
-
value: entry.value,
|
|
110044
|
-
metadata: {
|
|
110045
|
-
timestamp: entry.timestamp,
|
|
110046
|
-
hits: entry.hits,
|
|
110047
|
-
lastAccessed: entry.lastAccessed
|
|
110048
|
-
}
|
|
110049
|
-
}));
|
|
110050
|
-
}
|
|
110051
|
-
/**
|
|
110052
|
-
* Clean up expired entries
|
|
110053
|
-
*
|
|
110054
|
-
* Useful for periodic maintenance
|
|
110055
|
-
*
|
|
110056
|
-
* @returns Number of entries cleaned
|
|
109884
|
+
* Clean expired entries
|
|
110057
109885
|
*/
|
|
110058
109886
|
cleanExpired() {
|
|
110059
109887
|
const now = Date.now();
|
|
110060
|
-
let
|
|
109888
|
+
let cleaned = 0;
|
|
110061
109889
|
for (const [key, entry] of this.cache.entries()) {
|
|
110062
|
-
if (now - entry.timestamp >
|
|
109890
|
+
if (now - entry.timestamp > entry.ttl) {
|
|
110063
109891
|
this.cache.delete(key);
|
|
110064
|
-
|
|
110065
|
-
}
|
|
110066
|
-
}
|
|
110067
|
-
if (cleanedCount > 0 && this.debug) {
|
|
110068
|
-
console.log(`\u{1F9F9} [${this.name}] Cleaned ${cleanedCount} expired entries`);
|
|
110069
|
-
}
|
|
110070
|
-
return cleanedCount;
|
|
110071
|
-
}
|
|
110072
|
-
/**
|
|
110073
|
-
* Check if cache entry is expired
|
|
110074
|
-
*/
|
|
110075
|
-
isExpired(entry) {
|
|
110076
|
-
return Date.now() - entry.timestamp > this.ttlMs;
|
|
110077
|
-
}
|
|
110078
|
-
/**
|
|
110079
|
-
* Evict least recently used entry
|
|
110080
|
-
*/
|
|
110081
|
-
evictLRU() {
|
|
110082
|
-
let oldestKey = null;
|
|
110083
|
-
let oldestAccess = Infinity;
|
|
110084
|
-
for (const [key, entry] of this.cache.entries()) {
|
|
110085
|
-
if (entry.lastAccessed < oldestAccess) {
|
|
110086
|
-
oldestAccess = entry.lastAccessed;
|
|
110087
|
-
oldestKey = key;
|
|
110088
|
-
}
|
|
110089
|
-
}
|
|
110090
|
-
if (oldestKey !== null) {
|
|
110091
|
-
this.cache.delete(oldestKey);
|
|
110092
|
-
this.stats.evictions++;
|
|
110093
|
-
if (this.debug) {
|
|
110094
|
-
const timeSinceAccess = Date.now() - oldestAccess;
|
|
110095
|
-
console.log(
|
|
110096
|
-
`\u267B\uFE0F [${this.name}] Cache EVICT (LRU): ${String(oldestKey)} (last accessed: ${timeSinceAccess}ms ago)`
|
|
110097
|
-
);
|
|
109892
|
+
cleaned++;
|
|
110098
109893
|
}
|
|
110099
109894
|
}
|
|
109895
|
+
return cleaned;
|
|
110100
109896
|
}
|
|
110101
109897
|
/**
|
|
110102
|
-
* Get
|
|
110103
|
-
*
|
|
110104
|
-
* If key exists in cache, returns cached value.
|
|
110105
|
-
* Otherwise, computes value using provided function and caches it.
|
|
110106
|
-
*
|
|
110107
|
-
* @param key - Cache key
|
|
110108
|
-
* @param compute - Function to compute value if not in cache
|
|
110109
|
-
* @param ttl - Optional custom TTL for this entry
|
|
110110
|
-
* @returns Cached or computed value
|
|
110111
|
-
*/
|
|
110112
|
-
async getOrCompute(key, compute, ttl) {
|
|
110113
|
-
const cached = this.get(key);
|
|
110114
|
-
if (cached !== null) {
|
|
110115
|
-
return cached;
|
|
110116
|
-
}
|
|
110117
|
-
const existing = this.inflight.get(key);
|
|
110118
|
-
if (existing) {
|
|
110119
|
-
return existing;
|
|
110120
|
-
}
|
|
110121
|
-
const computePromise = (async () => {
|
|
110122
|
-
try {
|
|
110123
|
-
const value = await compute();
|
|
110124
|
-
this.set(key, value, ttl);
|
|
110125
|
-
return value;
|
|
110126
|
-
} finally {
|
|
110127
|
-
this.inflight.delete(key);
|
|
110128
|
-
}
|
|
110129
|
-
})();
|
|
110130
|
-
this.inflight.set(key, computePromise);
|
|
110131
|
-
return computePromise;
|
|
110132
|
-
}
|
|
110133
|
-
/**
|
|
110134
|
-
* Get or compute value with Result wrapper
|
|
109898
|
+
* Get cache statistics
|
|
110135
109899
|
*/
|
|
110136
|
-
|
|
110137
|
-
|
|
110138
|
-
|
|
110139
|
-
|
|
110140
|
-
|
|
110141
|
-
|
|
110142
|
-
if (existing) {
|
|
110143
|
-
return existing;
|
|
110144
|
-
}
|
|
110145
|
-
const computePromise = (async () => {
|
|
110146
|
-
try {
|
|
110147
|
-
return await compute();
|
|
110148
|
-
} finally {
|
|
110149
|
-
this.inflightResult.delete(key);
|
|
110150
|
-
}
|
|
110151
|
-
})();
|
|
110152
|
-
this.inflightResult.set(key, computePromise);
|
|
110153
|
-
const result = await computePromise;
|
|
110154
|
-
if (result.success) {
|
|
110155
|
-
this.set(key, result.value, ttl);
|
|
110156
|
-
}
|
|
110157
|
-
return result;
|
|
109900
|
+
getStats() {
|
|
109901
|
+
return {
|
|
109902
|
+
size: this.cache.size,
|
|
109903
|
+
maxSize: this.maxSize,
|
|
109904
|
+
ttlMs: this.ttlMs
|
|
109905
|
+
};
|
|
110158
109906
|
}
|
|
110159
109907
|
};
|
|
110160
109908
|
var CacheManager = class {
|
|
110161
109909
|
caches = /* @__PURE__ */ new Map();
|
|
110162
|
-
|
|
110163
|
-
constructor(
|
|
110164
|
-
this.
|
|
109910
|
+
debug;
|
|
109911
|
+
constructor(config = {}) {
|
|
109912
|
+
this.debug = config.debug || false;
|
|
110165
109913
|
}
|
|
110166
109914
|
/**
|
|
110167
|
-
*
|
|
110168
|
-
*
|
|
110169
|
-
* @param name - Unique cache name
|
|
110170
|
-
* @param config - Optional cache-specific configuration
|
|
110171
|
-
* @returns LRU cache instance
|
|
109915
|
+
* Get or create a cache instance
|
|
110172
109916
|
*/
|
|
110173
109917
|
getCache(name, config) {
|
|
110174
|
-
|
|
110175
|
-
|
|
110176
|
-
return existingCache;
|
|
109918
|
+
if (this.caches.has(name)) {
|
|
109919
|
+
return this.caches.get(name);
|
|
110177
109920
|
}
|
|
110178
|
-
const
|
|
110179
|
-
...this.globalConfig,
|
|
110180
|
-
...config,
|
|
110181
|
-
name
|
|
110182
|
-
};
|
|
110183
|
-
const cache = new LRUCache(mergedConfig);
|
|
109921
|
+
const cache = new Cache(config);
|
|
110184
109922
|
this.caches.set(name, cache);
|
|
109923
|
+
if (this.debug) {
|
|
109924
|
+
console.log(`[CacheManager] Created cache: ${name}`, config);
|
|
109925
|
+
}
|
|
110185
109926
|
return cache;
|
|
110186
109927
|
}
|
|
110187
109928
|
/**
|
|
@@ -110196,11 +109937,11 @@ var CacheManager = class {
|
|
|
110196
109937
|
* Clean expired entries from all caches
|
|
110197
109938
|
*/
|
|
110198
109939
|
cleanAllExpired() {
|
|
110199
|
-
let
|
|
109940
|
+
let total = 0;
|
|
110200
109941
|
for (const cache of this.caches.values()) {
|
|
110201
|
-
|
|
109942
|
+
total += cache.cleanExpired();
|
|
110202
109943
|
}
|
|
110203
|
-
return
|
|
109944
|
+
return total;
|
|
110204
109945
|
}
|
|
110205
109946
|
/**
|
|
110206
109947
|
* Get statistics for all caches
|
|
@@ -110213,16 +109954,11 @@ var CacheManager = class {
|
|
|
110213
109954
|
return stats;
|
|
110214
109955
|
}
|
|
110215
109956
|
/**
|
|
110216
|
-
*
|
|
109957
|
+
* Destroy cache manager
|
|
110217
109958
|
*/
|
|
110218
|
-
|
|
110219
|
-
|
|
110220
|
-
|
|
110221
|
-
/**
|
|
110222
|
-
* Delete a named cache
|
|
110223
|
-
*/
|
|
110224
|
-
deleteCache(name) {
|
|
110225
|
-
return this.caches.delete(name);
|
|
109959
|
+
destroy() {
|
|
109960
|
+
this.clearAll();
|
|
109961
|
+
this.caches.clear();
|
|
110226
109962
|
}
|
|
110227
109963
|
};
|
|
110228
109964
|
function createCacheManager(config) {
|