no dogma blog
no dogma blog
Blog Posts
Podcast
Web API Lambda Course
Polly Course
Photos
Contact
Support this Site
About
RSS
Light
Dark
Automatic
MemoryCache
Putting Lazy Tasks in a Cache, and Computing Only Once, When First Requested
This is an update to an earlier post on caching Tasks and only executing them when first accessed. This version uses Lazy<Task
> to hold the Task.
Sep 12, 2025
#
Cache
,
Task
,
MemoryCache
,
Async
,
Asynchronous
,
WebApi
,
Lazy
Putting Tasks in a Cache, and Computing Only Once, When First Requested
Caches are usually used to store concrete values, but with C# you can store tasks for work you want to perform only once, at the time the key is first requested from the cache.
Mar 19, 2025
#
Cache
,
Task
,
MemoryCache
,
Async
,
Asynchronous
,
WebApi
Cite
×