diff --git a/packages/nocodb/src/cache/RedisCacheMgr.ts b/packages/nocodb/src/cache/RedisCacheMgr.ts index a6b8030e17..0db2fb0ed3 100644 --- a/packages/nocodb/src/cache/RedisCacheMgr.ts +++ b/packages/nocodb/src/cache/RedisCacheMgr.ts @@ -1,7 +1,7 @@ import debug from 'debug'; import Redis from 'ioredis'; import CacheMgr from './CacheMgr'; -import { CacheDelDirection, CacheGetType, CacheScope } from '~/utils/globals'; +import { CacheDelDirection, CacheGetType } from '~/utils/globals'; const log = debug('nc:cache'); @@ -207,13 +207,6 @@ export default class RedisCacheMgr extends CacheMgr { const propValues = props.map((p) => o[p]); // e.g. nc:::: getKey = `${this.prefix}:${scope}:${propValues.join(':')}`; - } else { - // e.g. nc::: - 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(`RedisCacheMgr::setList: setting key ${getKey}`); diff --git a/packages/nocodb/src/cache/RedisMockCacheMgr.ts b/packages/nocodb/src/cache/RedisMockCacheMgr.ts index a34642beb4..a8593be4f1 100644 --- a/packages/nocodb/src/cache/RedisMockCacheMgr.ts +++ b/packages/nocodb/src/cache/RedisMockCacheMgr.ts @@ -2,7 +2,7 @@ import debug from 'debug'; import Redis from 'ioredis-mock'; import CacheMgr from './CacheMgr'; import type IORedis from 'ioredis'; -import { CacheDelDirection, CacheGetType, CacheScope } from '~/utils/globals'; +import { CacheDelDirection, CacheGetType } from '~/utils/globals'; const log = debug('nc:cache'); export default class RedisMockCacheMgr extends CacheMgr { @@ -205,13 +205,6 @@ export default class RedisMockCacheMgr extends CacheMgr { const propValues = props.map((p) => o[p]); // e.g. nc:::: getKey = `${this.prefix}:${scope}:${propValues.join(':')}`; - } else { - // e.g. nc::: - 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}`); diff --git a/packages/nocodb/src/models/ModelRoleVisibility.ts b/packages/nocodb/src/models/ModelRoleVisibility.ts index 23f64e3e9b..90e3c17af2 100644 --- a/packages/nocodb/src/models/ModelRoleVisibility.ts +++ b/packages/nocodb/src/models/ModelRoleVisibility.ts @@ -36,7 +36,12 @@ export default class ModelRoleVisibility implements ModelRoleVisibilityType { null, MetaTable.MODEL_ROLE_VISIBILITY, ); - await NocoCache.setList(CacheScope.MODEL_ROLE_VISIBILITY, [baseId], data); + await NocoCache.setList( + CacheScope.MODEL_ROLE_VISIBILITY, + [baseId], + data, + ['fk_view_id', 'role'], + ); } return data?.map((baseData) => new ModelRoleVisibility(baseData)); }