3 ms·
The traditional thing would be to have an init() function that is required to be called at the top of main() or before any other methods that need it. But I agr
by duped 11mo ago
The traditional thing would be to have an init() function that is required to be called at the top of main() or before any other methods that need it. But I agree with your point.
- never_inline 11mo agoNow lets say its an async cache instead of singleton.
- duped 11mo agoReturn the cached item if it exists else spawn a task to update it (doing nothing if the task has already been spawned), await the task and return the cached item.
- never_inline 11mo agoThanks, that's a useful trick.