Memoize that handles async-functions