UNPKG

@nerjs/batchloader

Version:

`BatchLoader` is a tool for batching data requests with support for deduplication, caching, and parallel task management. It is designed to enhance flexibility and performance in scenarios requiring asynchronous data processing. This module was inspired b

13 lines (12 loc) 522 B
import { BatchLoaderFn, IBatchAggregatorMetrics, IBatchAggregatorOptions } from './interfaces'; export declare class BatchAggregator<T, R> { private readonly batchLoaderFn; private readonly options; private readonly metrics?; private readonly timekeeper; private readonly batchRunner; constructor(batchLoaderFn: BatchLoaderFn<T, R>, options: IBatchAggregatorOptions, metrics?: IBatchAggregatorMetrics | undefined); private getCurrentTask; load(request: T): Promise<R>; clear(): void; }