CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
cache.d.cts37 linesDownload Raw Back to core
1import { entityKind } from "../../entity.cjs";2import type { Table } from "../../index.cjs";3import type { CacheConfig } from "./types.cjs";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