AK-21/Graphite-Industrial-Intelligence
0
1import { entityKind } from "../../entity.js";2import type { Table } from "../../index.js";3import type { CacheConfig } from "./types.js";4export declare abstract class Cache {5 static readonly [entityKind]: string;6 abstract strategy(): 'explicit' | 'all';7 /**8 * Invoked if we should check cache for cached response9 * @param sql10 * @param tables11 */12 abstract get(key: string, tables: string[], isTag: boolean, isAutoInvalidate?: boolean): Promise<any[] | undefined>;13 /**14 * Invoked if new query should be inserted to cache15 * @param sql16 * @param tables17 */18 abstract put(hashedQuery: string, response: any, tables: string[], isTag: boolean, config?: CacheConfig): Promise<void>;19 /**20 * Invoked if insert, update, delete was invoked21 * @param tables22 */23 abstract onMutate(params: MutationOption): Promise<void>;24}25export declare class NoopCache extends Cache {26 strategy(): "all";27 static readonly [entityKind]: string;28 get(_key: string): Promise<any[] | undefined>;29 put(_hashedQuery: string, _response: any, _tables: string[], _config?: any): Promise<void>;30 onMutate(_params: MutationOption): Promise<void>;31}32export type MutationOption = {33 tags?: string | string[];34 tables?: Table<any> | Table<any>[] | string | string[];35};36export declare function hashQuery(sql: string, params?: any[]): Promise<string>;37 