I love working with async / await in c#. Once you get used to it, and know a bit of the quirks, it becomes second nature. I’m finding that all my methods become async.. As terry prattchet used to say.. It’s Turtles (or in this case async) all the way down.
So I have nice asynchronous controllers, nice asynchronous methods to do data access.. And then I wanted to do caching today. But to my surprise there is no async cache. Ok, I’ve found an async cache in the paralell extensions. While it certainly allows me to cache async responses, I was missing some features I’m used to in a normal caching implementation, such as cache expiration or LRU expiration.
So I decided to
steal copy the source code from the parallel extensions and add some expiration logic to it. Here’s the result. Hope you like it. Oh.. the logging implementation is LibLog.