UNPKG

@graphql-mesh/cache-file

Version:
16 lines (15 loc) 562 B
import DataLoader from 'dataloader'; import { ImportFn, KeyValueCache } from '@graphql-mesh/types'; export default class FileCache<V = any> implements KeyValueCache<V> { json$: Promise<Record<string, V>>; absolutePath: string; writeDataLoader: DataLoader<string, string>; constructor({ path, importFn }: { path: string; importFn: ImportFn; }); getKeysByPrefix(prefix: string): Promise<string[]>; get(name: string): Promise<V>; set(name: string, value: V): Promise<void>; delete(name: string): Promise<void>; }