I'm finding that, when multiple threads call .GetOrAdd() on the same empty ICacheManager<T> instance with the same key value, that the valueFactory func is called multiple times, indicating an apparent lack of any synchronization within .GetOrAdd().
Is this the correct behavior? My expectation is that the first thread to call .GetOrAdd() when the given key does not exist in cache would block other callers asking for the same key until the valueFactory func is complete and then return that newly cached item.
I'm finding that, when multiple threads call
.GetOrAdd()on the same emptyICacheManager<T>instance with the same key value, that thevalueFactoryfunc is called multiple times, indicating an apparent lack of any synchronization within.GetOrAdd().Is this the correct behavior? My expectation is that the first thread to call
.GetOrAdd()when the given key does not exist in cache would block other callers asking for the same key until thevalueFactoryfunc is complete and then return that newly cached item.