Sponsor: Using RabbitMQ or Azure Service Bus in your .NET systems? Well, you could just use their SDKs and roll your own serialization, routing, outbox, retries, and telemetry. I mean, seriously, how hard could it be?
I’ve been moving some data access code to to use Lazy<T> whenever I want to defer actually fetching the data until it’s first needed. What I’ve always found interesting is there is no Lazy Async.
In the exact use case it’s when an application loads, there is some static data loaded from a database. This data is the cached for later use.
However, in many situations it’s not actually needed until much later if at all. Why take the performance hit of fetching the data on app startup if that data is often times not needed?
That’s the whole purpose of Lazy<T>. But as mentioned, why is there no Lazy Async? If i want to defer IO, that’s generally async.
Here is more info on Lazy Initialization if it’s new to you.