Wrap an async lookup so calls with the same arguments run once per request.
Within a memo scope the first call executes and every later call with the
same key returns the same value — including the same in-flight promise, so
concurrent calls share one execution. Rejected promises are evicted, so a
failed lookup is retried by the next call rather than memoized. Outside a
scope the function calls through uncached.
Memoize reads, not mutations. When a mutation in the same infra module
makes a memoized read stale, call memoized.invalidate(...) with the
read's arguments.
Wrap an async lookup so calls with the same arguments run once per request.
Within a memo scope the first call executes and every later call with the same key returns the same value — including the same in-flight promise, so concurrent calls share one execution. Rejected promises are evicted, so a failed lookup is retried by the next call rather than memoized. Outside a scope the function calls through uncached.
Memoize reads, not mutations. When a mutation in the same infra module makes a memoized read stale, call
memoized.invalidate(...)with the read's arguments.