@byted-apaas/server-sdk-node 1.1.26-beta.2 → 1.1.26
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.
|
@@ -424,12 +424,10 @@ async function handleLookupCondition(conditions) {
|
|
|
424
424
|
let lookupMap = new Map(), dateSet = new Set();
|
|
425
425
|
let firstObjApiName = conditions[0].left.settings.fieldPath[0].objectApiName;
|
|
426
426
|
let fields = [];
|
|
427
|
-
|
|
427
|
+
const needReadCache = server_common_node_1.utils.getLaneID() !== ''; // 仅打包发布 2.0 支持走 cache
|
|
428
428
|
let cacheResult = null;
|
|
429
429
|
if (needReadCache) { // 打包发布 2.0 读缓存
|
|
430
430
|
cacheResult = getLookupObjectAPINamesFromCache(firstObjApiName, queryMap);
|
|
431
|
-
// todo wby 方便 qa 测试的日志
|
|
432
|
-
console.log(`\n=====>[handleLookupCondition] getLookupObjectAPINamesFromCache: ${JSON.stringify(cacheResult)}\n`);
|
|
433
431
|
}
|
|
434
432
|
// 命中缓存
|
|
435
433
|
if (cacheResult !== null && cacheResult.missFields.length === 0) {
|
|
@@ -594,7 +592,7 @@ function setFieldCache(objectApiName, fieldName, field) {
|
|
|
594
592
|
localCache.set(getFieldCacheKey(objectApiName, fieldName), field, 60); // 缓存60s
|
|
595
593
|
}
|
|
596
594
|
function getFieldCache(objectApiName, fieldName) {
|
|
597
|
-
|
|
595
|
+
const field = localCache.get(getFieldCacheKey(objectApiName, fieldName));
|
|
598
596
|
return field;
|
|
599
597
|
}
|
|
600
598
|
function getFieldCacheKey(objectApiName, fieldName) {
|
|
@@ -603,8 +601,8 @@ function getFieldCacheKey(objectApiName, fieldName) {
|
|
|
603
601
|
function getLookupObjectAPINamesFromCache(firstObjApiName, queryMap) {
|
|
604
602
|
var missFields = [];
|
|
605
603
|
var successFields = [];
|
|
606
|
-
for (const [fieldName
|
|
607
|
-
|
|
604
|
+
for (const [fieldName] of queryMap) {
|
|
605
|
+
const field = getFieldCache(firstObjApiName, fieldName);
|
|
608
606
|
if (field) {
|
|
609
607
|
successFields.push(field);
|
|
610
608
|
}
|