@dbcube/core 3.0.8 → 3.0.9
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/dist/index.cjs +15 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -768,6 +768,9 @@ var net = __toESM(require("net"));
|
|
|
768
768
|
var import_child_process2 = require("child_process");
|
|
769
769
|
var globalTcpServers = /* @__PURE__ */ new Map();
|
|
770
770
|
var globalTcpConnections = /* @__PURE__ */ new Map();
|
|
771
|
+
var queryCache = /* @__PURE__ */ new Map();
|
|
772
|
+
var cacheSize = 0;
|
|
773
|
+
var MAX_CACHE_SIZE = 500;
|
|
771
774
|
var QueryEngine = class {
|
|
772
775
|
name;
|
|
773
776
|
config;
|
|
@@ -924,6 +927,17 @@ var QueryEngine = class {
|
|
|
924
927
|
sleep(ms) {
|
|
925
928
|
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
926
929
|
}
|
|
930
|
+
getCachedDML(dmlJson) {
|
|
931
|
+
if (queryCache.has(dmlJson)) {
|
|
932
|
+
return queryCache.get(dmlJson);
|
|
933
|
+
}
|
|
934
|
+
const parsed = JSON.parse(dmlJson);
|
|
935
|
+
if (cacheSize < MAX_CACHE_SIZE) {
|
|
936
|
+
queryCache.set(dmlJson, parsed);
|
|
937
|
+
cacheSize++;
|
|
938
|
+
}
|
|
939
|
+
return parsed;
|
|
940
|
+
}
|
|
927
941
|
async startTcpServer() {
|
|
928
942
|
await this.initializeBinary();
|
|
929
943
|
if (!this.binary) {
|
|
@@ -1064,7 +1078,7 @@ var QueryEngine = class {
|
|
|
1064
1078
|
isResolved = true;
|
|
1065
1079
|
reject(new Error("TCP request timeout"));
|
|
1066
1080
|
}
|
|
1067
|
-
},
|
|
1081
|
+
}, 100);
|
|
1068
1082
|
const onData = (data) => {
|
|
1069
1083
|
responseBuffer += data.toString();
|
|
1070
1084
|
const match = responseBuffer.match(/PROCESS_RESPONSE:(\{.*\})/);
|