32 references to GetOrCreateAsync
Microsoft.Extensions.Caching.Hybrid.Tests (32)
BufferReleaseTests.cs (9)
39var first = await cache.GetOrCreateAsync(key, _ => GetAsync()); 51var second = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying); 57var third = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying); 130var first = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying); // we expect this to come from L2, hence NoUnderlying 142var second = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying); 148var third = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying); 189var first = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying); // we expect this to come from L2, hence NoUnderlying 201var second = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying); 207var third = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying);
FunctionalTests.cs (11)
26Assert.Equal(42, await cache.GetOrCreateAsync(key, _ => new ValueTask<int>(42))); 30Assert.Equal(42, await cache.GetOrCreateAsync(key, _ => new ValueTask<int>(96))); 34Assert.Equal(96, await cache.GetOrCreateAsync(key, _ => new ValueTask<int>(96))); 42Assert.Equal(42, await cache.GetOrCreateAsync(key, _ => new ValueTask<int>(42))); 46Assert.Equal(42, await cache.GetOrCreateAsync(key, _ => new ValueTask<int>(96))); 54Assert.Equal(42, await cache.GetOrCreateAsync(key, _ => new ValueTask<int>(42))); 58Assert.Equal(42, await cache.GetOrCreateAsync(key, _ => new ValueTask<int>(96))); 62Assert.Equal(96, await cache.GetOrCreateAsync(key, _ => new ValueTask<int>(96))); 70Assert.Equal(42, await cache.GetOrCreateAsync(key, _ => new ValueTask<int>(42))); 73Assert.Equal(42, await cache.GetOrCreateAsync(key, _ => new ValueTask<int>(96))); 77Assert.Equal(96, await cache.GetOrCreateAsync(key, _ => new ValueTask<int>(96)));
RedisTests.cs (1)
75await cache.GetOrCreateAsync<Guid>(key, _ =>
ServiceConstructionTests.cs (1)
95var actual = await cache.GetOrCreateAsync(Me(), async _ => expected);
SizeTests.cs (4)
28var actual = await cache.GetOrCreateAsync<string>(Key, ct => new(expected)); 38actual = await cache.GetOrCreateAsync<string>(Key, ct => new(Guid.NewGuid().ToString())); 71var actual = await cache.GetOrCreateAsync<MutablePoco>(Key, ct => new(new MutablePoco { Value = expected })); 77actual = await cache.GetOrCreateAsync<MutablePoco>(Key, ct => new(new MutablePoco { Value = Guid.NewGuid().ToString() }));
StampedeTests.cs (6)
81results[i] = cache.GetOrCreateAsync(Me(), async ct => 117results[i] = cache.GetOrCreateAsync(Me(), async ct => 170results[i] = cache.GetOrCreateAsync(Me(), async ct => 248results[i] = cache.GetOrCreateAsync(Me(), async ct => 322var first = cache.GetOrCreateAsync(Me(), async ct => 329var second = cache.GetOrCreateAsync(Me(), async ct =>