Just a small change to better handle concurrent usage of Clear(), because with the old code this may happen:
public void Clear()
{
if (_cache != null)
{
_cache.Dispose();
// AFTER THIS LINE ACCESS TO _cache WOULD THROW AN ObjectDisposedException
}
_cache = new MemoryCache(new MemoryCacheOptions());
}
Just a small change to better handle concurrent usage of Clear(), because with the old code this may happen: