Batch and cache database queries or other potentially expensive data lookups. The main motivation for this library is to solve the “N + 1” query problem seen in GraphQL and elsewhere. This library takes heavy influence from the GraphQL Foundation’s DataLoader.
Used to batch and cache loads from some datastore. A
Batcher can be used
with any type that implements
Batchers are asynchronous, and
designed to be passed and shared between threads or tasks. Cloning a
Batcher is shallow and can be used to use the same
multiple threads or tasks.