For starters let me just throw it out there that I know the code below is not thread safe (correction: might be). What I am struggling with is finding an implementation that
The default MS-provided MemoryCache
is entirely thread safe. Any custom implementation that derives from MemoryCache
may not be thread safe. If you're using plain MemoryCache
out of the box, it is thread safe. Browse the source code of my open source distributed caching solution to see how I use it (MemCache.cs):
https://github.com/haneytron/dache/blob/master/Dache.CacheHost/Storage/MemCache.cs