Browse Source

fix: deprecate delAll command

pull/7464/head
mertmit 10 months ago
parent
commit
8ae2a4f501
  1. 1
      packages/nocodb/src/cache/CacheMgr.ts
  2. 5
      packages/nocodb/src/cache/NocoCache.ts
  3. 19
      packages/nocodb/src/cache/RedisCacheMgr.ts
  4. 20
      packages/nocodb/src/cache/RedisMockCacheMgr.ts
  5. 4
      packages/nocodb/src/models/Column.ts
  6. 5
      packages/nocodb/src/models/Model.ts
  7. 1
      packages/nocodb/src/models/Sort.ts

1
packages/nocodb/src/cache/CacheMgr.ts vendored

@ -8,7 +8,6 @@ export default abstract class CacheMgr {
): Promise<any>;
public abstract incrby(key: string, value: number): Promise<any>;
public abstract del(key: string[] | string): Promise<any>;
public abstract delAll(scope: string, pattern: string): Promise<any[]>;
public abstract getList(
scope: string,
list: string[],

5
packages/nocodb/src/cache/NocoCache.ts vendored

@ -57,11 +57,6 @@ export default class NocoCache {
return this.client.del(`${this.prefix}:${key}`);
}
public static async delAll(scope: string, pattern: string): Promise<any[]> {
if (this.cacheDisabled) return Promise.resolve([]);
return this.client.delAll(scope, pattern);
}
public static async getList(
scope: string,
subKeys: string[],

19
packages/nocodb/src/cache/RedisCacheMgr.ts vendored

@ -126,25 +126,6 @@ export default class RedisCacheMgr extends CacheMgr {
return this.client.incrby(key, value);
}
// @ts-ignore
async delAll(scope: string, pattern: string): Promise<any[]> {
// Example: nc:<orgs>:model:*:<id>
const keys = await this.client.keys(`${this.prefix}:${scope}:${pattern}`);
log(
`RedisCacheMgr::delAll: deleting all keys with pattern ${this.prefix}:${scope}:${pattern}`,
);
await Promise.all(
keys.map(async (k) => {
await this.deepDel(scope, k, CacheDelDirection.CHILD_TO_PARENT);
}),
);
return Promise.all(
keys.map(async (k) => {
await this.del(k);
}),
);
}
async getList(
scope: string,
subKeys: string[],

20
packages/nocodb/src/cache/RedisMockCacheMgr.ts vendored

@ -123,26 +123,6 @@ export default class RedisMockCacheMgr extends CacheMgr {
return this.client.incrby(key, value);
}
// @ts-ignore
async delAll(scope: string, pattern: string): Promise<any[]> {
// Example: nc:<orgs>:model:*:<id>
const keys = await this.client.keys(`${this.prefix}:${scope}:${pattern}`);
log(
`RedisMockCacheMgr::delAll: deleting all keys with pattern ${this.prefix}:${scope}:${pattern}`,
);
await Promise.all(
keys.map(
async (k) =>
await this.deepDel(scope, k, CacheDelDirection.CHILD_TO_PARENT),
),
);
return Promise.all(
keys.map(async (k) => {
await this.del(k);
}),
);
}
async getList(
scope: string,
subKeys: string[],

4
packages/nocodb/src/models/Column.ts

@ -499,10 +499,6 @@ export default class Column<T = any> implements ColumnType {
);
}
public static async clear({ id }) {
await NocoCache.delAll(CacheScope.COLUMN, `*${id}*`);
}
public static async list(
{
fk_model_id,

5
packages/nocodb/src/models/Model.ts

@ -275,11 +275,6 @@ export default class Model implements TableType {
return modelList.map((m) => new Model(m));
}
public static async clear({ id }: { id: string }): Promise<void> {
await NocoCache.delAll(CacheScope.MODEL, `*${id}*`);
await Column.clearList({ fk_model_id: id });
}
public static async get(id: string, ncMeta = Noco.ncMeta): Promise<Model> {
let modelData =
id &&

1
packages/nocodb/src/models/Sort.ts

@ -91,7 +91,6 @@ export default class Sort {
order: 'asc',
},
});
await NocoCache.delAll(CacheScope.SORT, `${sortObj.fk_view_id}:*`);
await NocoCache.setList(CacheScope.SORT, [sortObj.fk_view_id], sortList);
} else {
await NocoCache.appendToList(

Loading…
Cancel
Save