Helper for use cases in which the maker function is async. For two
provideLazy calls with the same key, one may be making when the other call
starts and it would make again. (Then there'd be a collision when the second
tries to store the key.) This prevents that race condition by immediately
storing a Promise for the maker in an ephemeral store.
When the store argument is durable storage, note that it's possible for
termination to happen after the make completes and before it reaches durable
storage.
Call provideAsync to get or make the value associated with the key, when
the maker is asynchronous. If there already is one, return that. Otherwise,
call makeValue(key), remember it as the value for that key, and return
it.
Helper for use cases in which the maker function is async. For two provideLazy calls with the same key, one may be making when the other call starts and it would make again. (Then there'd be a collision when the second tries to store the key.) This prevents that race condition by immediately storing a Promise for the maker in an ephemeral store.
When the
store
argument is durable storage, note that it's possible for termination to happen after the make completes and before it reaches durable storage.