38 references to GetOrCreateAsync
Microsoft.Extensions.Caching.Hybrid.Tests (38)
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 (10)
57var actual = await cache.GetOrCreateAsync<string>(key!, ct => new(expected)); 67actual = await cache.GetOrCreateAsync<string>(key!, ct => new(Guid.NewGuid().ToString())); 124var actual = await cache.GetOrCreateAsync<MutablePoco>(key!, ct => new(new MutablePoco { Value = expected })); 130actual = await cache.GetOrCreateAsync<MutablePoco>(key!, ct => new(new MutablePoco { Value = Guid.NewGuid().ToString() })); 176await Assert.ThrowsAsync<KnownFailureException>(async () => await cache.GetOrCreateAsync("key", func)); 180var first = await cache.GetOrCreateAsync("key", func); 181var second = await cache.GetOrCreateAsync("key", func); 242await Assert.ThrowsAsync<KnownFailureException>(async () => await cache.GetOrCreateAsync("key", func)); 246var first = await cache.GetOrCreateAsync("key", func); 247var second = await cache.GetOrCreateAsync("key", func);
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 =>