Browse Source

feat(nocodb): revise cache getList response

pull/5430/head
Wing-Kam Wong 2 years ago
parent
commit
252d83272b
  1. 8
      packages/nocodb/src/lib/cache/CacheMgr.ts
  2. 11
      packages/nocodb/src/lib/cache/NocoCache.ts

8
packages/nocodb/src/lib/cache/CacheMgr.ts vendored

@ -4,7 +4,13 @@ export default abstract class CacheMgr {
public abstract del(key: string): Promise<any>; public abstract del(key: string): Promise<any>;
public abstract getAll(pattern: string): Promise<any[]>; public abstract getAll(pattern: string): Promise<any[]>;
public abstract delAll(scope: string, pattern: string): Promise<any[]>; public abstract delAll(scope: string, pattern: string): Promise<any[]>;
public abstract getList(scope: string, list: string[]): Promise<any[]>; public abstract getList(
scope: string,
list: string[]
): Promise<{
list: any[];
isEmptyList: boolean;
}>;
public abstract setList( public abstract setList(
scope: string, scope: string,
subListKeys: string[], subListKeys: string[],

11
packages/nocodb/src/lib/cache/NocoCache.ts vendored

@ -56,8 +56,15 @@ export default class NocoCache {
public static async getList( public static async getList(
scope: string, scope: string,
subKeys: string[] subKeys: string[]
): Promise<any[]> { ): Promise<{
if (this.cacheDisabled) return Promise.resolve([]); list: any[];
isEmptyList: boolean;
}> {
if (this.cacheDisabled)
return Promise.resolve({
list: [],
isEmptyList: true,
});
return this.client.getList(scope, subKeys); return this.client.getList(scope, subKeys);
} }

Loading…
Cancel
Save