Putting Lazy Tasks in a Cache, and Computing Only Once, When First Requested

This post is an update to an earlier post on caching Tasks and only executing them when first accessed. In that post, I used Task.Start() to start the task when it was first accessed. This works, but there is another way, as suggested by Steven Cleary in the comments on that post. It stores Lazy<Task<string>> in the cache, and when the value is first accessed, the Value property of the Lazy<T> is…