This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
GetOrCreate / GetOrCreateAsync on IMemoryCache creates cache entry even when factory throws #211
Closed
Description
It seems wrong that a cache entry is added with the value null
when the factory method throws:
try
{
memoryCache.GetOrCreate("key", entry =>
{
throw new Exception();
return 123;
});
} catch (Exception e)
{
// memoryCache now has an entry for "key" with the value null. This seems odd.
}
The expected behaviour should be that the value is not added to the cache if the factory throws.