|
|
@ -135,10 +135,18 @@ export default class Model implements TableType { |
|
|
|
MetaTable.MODELS, |
|
|
|
MetaTable.MODELS, |
|
|
|
insertObj, |
|
|
|
insertObj, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
if (baseId) { |
|
|
|
|
|
|
|
await NocoCache.appendToList( |
|
|
|
|
|
|
|
CacheScope.MODEL, |
|
|
|
|
|
|
|
[projectId, baseId], |
|
|
|
|
|
|
|
`${CacheScope.MODEL}:${id}`, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// cater cases where baseId is not required
|
|
|
|
|
|
|
|
// e.g. xcVisibilityMetaGet
|
|
|
|
await NocoCache.appendToList( |
|
|
|
await NocoCache.appendToList( |
|
|
|
CacheScope.MODEL, |
|
|
|
CacheScope.MODEL, |
|
|
|
[projectId, baseId], |
|
|
|
[projectId], |
|
|
|
`${CacheScope.MODEL}:${id}`, |
|
|
|
`${CacheScope.MODEL}:${id}`, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
@ -690,13 +698,13 @@ export default class Model implements TableType { |
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta = Noco.ncMeta, |
|
|
|
ncMeta = Noco.ncMeta, |
|
|
|
) { |
|
|
|
) { |
|
|
|
|
|
|
|
const cacheKey = base_id |
|
|
|
|
|
|
|
? `${CacheScope.MODEL}:${project_id}:${base_id}:${aliasOrId}` |
|
|
|
|
|
|
|
: `${CacheScope.MODEL}:${project_id}:${aliasOrId}`; |
|
|
|
const modelId = |
|
|
|
const modelId = |
|
|
|
project_id && |
|
|
|
project_id && |
|
|
|
aliasOrId && |
|
|
|
aliasOrId && |
|
|
|
(await NocoCache.get( |
|
|
|
(await NocoCache.get(cacheKey, CacheGetType.TYPE_OBJECT)); |
|
|
|
`${CacheScope.MODEL}:${project_id}:${aliasOrId}`, |
|
|
|
|
|
|
|
CacheGetType.TYPE_OBJECT, |
|
|
|
|
|
|
|
)); |
|
|
|
|
|
|
|
if (!modelId) { |
|
|
|
if (!modelId) { |
|
|
|
const model = base_id |
|
|
|
const model = base_id |
|
|
|
? await ncMeta.metaGet2( |
|
|
|
? await ncMeta.metaGet2( |
|
|
@ -742,10 +750,7 @@ export default class Model implements TableType { |
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
if (model) { |
|
|
|
if (model) { |
|
|
|
await NocoCache.set( |
|
|
|
await NocoCache.set(cacheKey, model.id); |
|
|
|
`${CacheScope.MODEL}:${project_id}:${aliasOrId}`, |
|
|
|
|
|
|
|
model.id, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
await NocoCache.set(`${CacheScope.MODEL}:${model.id}`, model); |
|
|
|
await NocoCache.set(`${CacheScope.MODEL}:${model.id}`, model); |
|
|
|
} |
|
|
|
} |
|
|
|
return model && new Model(model); |
|
|
|
return model && new Model(model); |
|
|
|