On this page
article
Warm Up
Warm up eagerly executes the wrapped function once, so that subsequent callers receive a pre-computed result.
Warm Up
What it is
Warm up eagerly executes the wrapped function once, so that subsequent callers receive a pre-computed result.
When to use it
- Preloading configuration at app startup.
- Warming caches before traffic arrives.
- Preparing heavy objects during idle time.
Async / sync support
| Wrapper | Support |
|---|---|
Func<R> | ✅ Async |
Func1<T, R> | ✅ Async |
Func2<T1, T2, R> | ✅ Async |
FuncSync<R> | ❌ No |
API reference
| |
No parameters.
Examples
Basic example
| |
Real-world example
| |
Best practices
- Use warm up at a known safe moment, such as app startup.
- Combine with
onceto avoid repeated warm-up. - Handle failures; an eager failure may still be acceptable if callers can retry.
Common pitfalls
- Resource waste: Warming unused data consumes memory and network.
- No cancellation: Once warm up starts, it runs to completion or failure.