Memoize Async Callback-Based Functions and Deduplicate In-Flight Requests
Implement a memoize wrapper specifically designed for Node.js-style callback-based async functions (fn(args, callback)). If the same function is called multiple times with the same arguments before the first call resolves, queue all callbacks and resolve them all together when the first result arrives — avoiding duplicate in-flight calls. This is called request deduplication or coalescing and is the mechanism behind SWR's deduplication and Apollo Client's request batching.