|
|
|
@ -185,6 +185,7 @@ export default class RedisMockCacheMgr extends CacheMgr {
|
|
|
|
|
scope: string, |
|
|
|
|
subListKeys: string[], |
|
|
|
|
list: any[], |
|
|
|
|
props: string[] = [], |
|
|
|
|
): Promise<boolean> { |
|
|
|
|
// remove null from arrays
|
|
|
|
|
subListKeys = subListKeys.filter((k) => k); |
|
|
|
@ -203,11 +204,18 @@ export default class RedisMockCacheMgr extends CacheMgr {
|
|
|
|
|
(await this.get(listKey, CacheGetType.TYPE_ARRAY)) || []; |
|
|
|
|
for (const o of list) { |
|
|
|
|
// construct key for Get
|
|
|
|
|
// e.g. nc:<orgs>:<scope>:<model_id_1>
|
|
|
|
|
let getKey = `${this.prefix}:${scope}:${o.id}`; |
|
|
|
|
// special case - MODEL_ROLE_VISIBILITY
|
|
|
|
|
if (scope === CacheScope.MODEL_ROLE_VISIBILITY) { |
|
|
|
|
getKey = `${this.prefix}:${scope}:${o.fk_view_id}:${o.role}`; |
|
|
|
|
if (props.length) { |
|
|
|
|
const propValues = props.map((p) => o[p]); |
|
|
|
|
// e.g. nc:<orgs>:<scope>:<prop_value_1>:<prop_value_2>
|
|
|
|
|
getKey = `${this.prefix}:${scope}:${propValues.join(':')}`; |
|
|
|
|
} else { |
|
|
|
|
// e.g. nc:<orgs>:<scope>:<model_id_1>
|
|
|
|
|
getKey = `${this.prefix}:${scope}:${o.id}`; |
|
|
|
|
// special case - MODEL_ROLE_VISIBILITY
|
|
|
|
|
if (scope === CacheScope.MODEL_ROLE_VISIBILITY) { |
|
|
|
|
getKey = `${this.prefix}:${scope}:${o.fk_view_id}:${o.role}`; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// set Get Key
|
|
|
|
|
log(`RedisMockCacheMgr::setList: setting key ${getKey}`); |
|
|
|
|