Module

Prospero.DataLoader

Package
purescript-prospero
Repository
rowtype-yoga/purescript-prospero

#DataLoader Source

newtype DataLoader k v

A DataLoader batches and caches individual key lookups. Create one per request to avoid stale caches across requests.

#mkDataLoader Source

mkDataLoader :: forall k v. Ord k => (Array k -> Aff (Map k v)) -> Aff (DataLoader k v)

Create a new DataLoader with a batch function.

#load Source

load :: forall k v. Ord k => DataLoader k v -> k -> Aff v

Load a single key. Batches with other concurrent loads and caches the result.