From f5e7d1b92c60ab287a47e5c9fd0fd4753a1d87f4 Mon Sep 17 00:00:00 2001 From: mertmit Date: Fri, 19 Jan 2024 14:19:25 +0000 Subject: [PATCH] feat: allow bulk delete of cache keys --- packages/nocodb/src/cache/CacheMgr.ts | 2 +- packages/nocodb/src/cache/RedisCacheMgr.ts | 4 ++-- packages/nocodb/src/cache/RedisMockCacheMgr.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/nocodb/src/cache/CacheMgr.ts b/packages/nocodb/src/cache/CacheMgr.ts index d5ae8b9af0..09bf885efa 100644 --- a/packages/nocodb/src/cache/CacheMgr.ts +++ b/packages/nocodb/src/cache/CacheMgr.ts @@ -7,7 +7,7 @@ export default abstract class CacheMgr { seconds: number, ): Promise; public abstract incrby(key: string, value: number): Promise; - public abstract del(key: string): Promise; + public abstract del(key: string[] | string): Promise; public abstract delAll(scope: string, pattern: string): Promise; public abstract getList( scope: string, diff --git a/packages/nocodb/src/cache/RedisCacheMgr.ts b/packages/nocodb/src/cache/RedisCacheMgr.ts index 0db2fb0ed3..5e52c8f007 100644 --- a/packages/nocodb/src/cache/RedisCacheMgr.ts +++ b/packages/nocodb/src/cache/RedisCacheMgr.ts @@ -42,9 +42,9 @@ export default class RedisCacheMgr extends CacheMgr { }; // @ts-ignore - async del(key: string): Promise { + async del(key: string[] | string): Promise { log(`RedisCacheMgr::del: deleting key ${key}`); - return this.client.del(key); + return this.client.del(Array.isArray(key) ? key : [key]); } // @ts-ignore diff --git a/packages/nocodb/src/cache/RedisMockCacheMgr.ts b/packages/nocodb/src/cache/RedisMockCacheMgr.ts index a8593be4f1..db45b29ae6 100644 --- a/packages/nocodb/src/cache/RedisMockCacheMgr.ts +++ b/packages/nocodb/src/cache/RedisMockCacheMgr.ts @@ -35,9 +35,9 @@ export default class RedisMockCacheMgr extends CacheMgr { }; // @ts-ignore - async del(key: string): Promise { + async del(key: string[] | string): Promise { log(`RedisMockCacheMgr::del: deleting key ${key}`); - return this.client.del(key); + return this.client.del(Array.isArray(key) ? key : [key]); } // @ts-ignore