43 references to GetOrCreateAsync
Microsoft.Extensions.Caching.Hybrid.Tests (43)
BufferReleaseTests.cs (9)
46var first = await cache.GetOrCreateAsync(key, _ => GetAsync()); 58var second = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying); 64var third = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying); 141var first = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying); // we expect this to come from L2, hence NoUnderlying 153var second = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying); 159var third = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying); 204var first = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying); // we expect this to come from L2, hence NoUnderlying 216var second = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying); 222var third = await cache.GetOrCreateAsync(key, _ => GetAsync(), _noUnderlying);
ExpirationTests.cs (5)
38guid0 = await cache.GetOrCreateAsync(key, callback, options); 41Assert.Equal(guid0, await cache.GetOrCreateAsync(key, callback, options)); 44Assert.Equal(guid0, await cache.GetOrCreateAsync(key, callback, options)); 47Assert.Equal(guid0, await cache.GetOrCreateAsync(key, callback, options)); 50Assert.NotEqual(guid0, await cache.GetOrCreateAsync(key, callback, options));
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)
99results[i] = cache.GetOrCreateAsync(Me(), async ct => 135results[i] = cache.GetOrCreateAsync(Me(), async ct => 188results[i] = cache.GetOrCreateAsync(Me(), async ct => 266results[i] = cache.GetOrCreateAsync(Me(), async ct => 340var first = cache.GetOrCreateAsync(Me(), async ct => 347var second = cache.GetOrCreateAsync(Me(), async ct =>