|
|
|
@ -135,12 +135,20 @@ export default class Model implements TableType {
|
|
|
|
|
MetaTable.MODELS, |
|
|
|
|
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( |
|
|
|
|
CacheScope.MODEL, |
|
|
|
|
[projectId], |
|
|
|
|
`${CacheScope.MODEL}:${id}`, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const view = await View.insert( |
|
|
|
|
{ |
|
|
|
@ -690,13 +698,13 @@ export default class Model implements TableType {
|
|
|
|
|
}, |
|
|
|
|
ncMeta = Noco.ncMeta, |
|
|
|
|
) { |
|
|
|
|
const cacheKey = base_id |
|
|
|
|
? `${CacheScope.MODEL}:${project_id}:${base_id}:${aliasOrId}` |
|
|
|
|
: `${CacheScope.MODEL}:${project_id}:${aliasOrId}`; |
|
|
|
|
const modelId = |
|
|
|
|
project_id && |
|
|
|
|
aliasOrId && |
|
|
|
|
(await NocoCache.get( |
|
|
|
|
`${CacheScope.MODEL}:${project_id}:${aliasOrId}`, |
|
|
|
|
CacheGetType.TYPE_OBJECT, |
|
|
|
|
)); |
|
|
|
|
(await NocoCache.get(cacheKey, CacheGetType.TYPE_OBJECT)); |
|
|
|
|
if (!modelId) { |
|
|
|
|
const model = base_id |
|
|
|
|
? await ncMeta.metaGet2( |
|
|
|
@ -742,10 +750,7 @@ export default class Model implements TableType {
|
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
if (model) { |
|
|
|
|
await NocoCache.set( |
|
|
|
|
`${CacheScope.MODEL}:${project_id}:${aliasOrId}`, |
|
|
|
|
model.id, |
|
|
|
|
); |
|
|
|
|
await NocoCache.set(cacheKey, model.id); |
|
|
|
|
await NocoCache.set(`${CacheScope.MODEL}:${model.id}`, model); |
|
|
|
|
} |
|
|
|
|
return model && new Model(model); |
|
|
|
|