@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.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -730,6 +730,9 @@ import * as net from "net";
|
|
|
730
730
|
import { spawn as spawn2 } from "child_process";
|
|
731
731
|
var globalTcpServers = /* @__PURE__ */ new Map();
|
|
732
732
|
var globalTcpConnections = /* @__PURE__ */ new Map();
|
|
733
|
+
var queryCache = /* @__PURE__ */ new Map();
|
|
734
|
+
var cacheSize = 0;
|
|
735
|
+
var MAX_CACHE_SIZE = 500;
|
|
733
736
|
var QueryEngine = class {
|
|
734
737
|
name;
|
|
735
738
|
config;
|
|
@@ -886,6 +889,17 @@ var QueryEngine = class {
|
|
|
886
889
|
sleep(ms) {
|
|
887
890
|
return new Promise((resolve5) => setTimeout(resolve5, ms));
|
|
888
891
|
}
|
|
892
|
+
getCachedDML(dmlJson) {
|
|
893
|
+
if (queryCache.has(dmlJson)) {
|
|
894
|
+
return queryCache.get(dmlJson);
|
|
895
|
+
}
|
|
896
|
+
const parsed = JSON.parse(dmlJson);
|
|
897
|
+
if (cacheSize < MAX_CACHE_SIZE) {
|
|
898
|
+
queryCache.set(dmlJson, parsed);
|
|
899
|
+
cacheSize++;
|
|
900
|
+
}
|
|
901
|
+
return parsed;
|
|
902
|
+
}
|
|
889
903
|
async startTcpServer() {
|
|
890
904
|
await this.initializeBinary();
|
|
891
905
|
if (!this.binary) {
|
|
@@ -1026,7 +1040,7 @@ var QueryEngine = class {
|
|
|
1026
1040
|
isResolved = true;
|
|
1027
1041
|
reject(new Error("TCP request timeout"));
|
|
1028
1042
|
}
|
|
1029
|
-
},
|
|
1043
|
+
}, 100);
|
|
1030
1044
|
const onData = (data) => {
|
|
1031
1045
|
responseBuffer += data.toString();
|
|
1032
1046
|
const match = responseBuffer.match(/PROCESS_RESPONSE:(\{.*\})/);
|