Browse Source

feat: allow bulk delete of cache keys

pull/7464/head
mertmit 11 months ago
parent
commit
f5e7d1b92c
  1. 2
      packages/nocodb/src/cache/CacheMgr.ts
  2. 4
      packages/nocodb/src/cache/RedisCacheMgr.ts
  3. 4
      packages/nocodb/src/cache/RedisMockCacheMgr.ts

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

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

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

@ -42,9 +42,9 @@ export default class RedisCacheMgr extends CacheMgr {
}; };
// @ts-ignore // @ts-ignore
async del(key: string): Promise<any> { async del(key: string[] | string): Promise<any> {
log(`RedisCacheMgr::del: deleting key ${key}`); log(`RedisCacheMgr::del: deleting key ${key}`);
return this.client.del(key); return this.client.del(Array.isArray(key) ? key : [key]);
} }
// @ts-ignore // @ts-ignore

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

@ -35,9 +35,9 @@ export default class RedisMockCacheMgr extends CacheMgr {
}; };
// @ts-ignore // @ts-ignore
async del(key: string): Promise<any> { async del(key: string[] | string): Promise<any> {
log(`RedisMockCacheMgr::del: deleting key ${key}`); log(`RedisMockCacheMgr::del: deleting key ${key}`);
return this.client.del(key); return this.client.del(Array.isArray(key) ? key : [key]);
} }
// @ts-ignore // @ts-ignore

Loading…
Cancel
Save