43 references to GetOrCreateAsync
Microsoft.Extensions.Caching.Hybrid.Tests (43)
BufferReleaseTests.cs (9)
46
var first = await cache.
GetOrCreateAsync
(key, _ => GetAsync());
58
var second = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying);
64
var third = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying);
141
var first = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying); // we expect this to come from L2, hence NoUnderlying
153
var second = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying);
159
var third = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying);
204
var first = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying); // we expect this to come from L2, hence NoUnderlying
216
var second = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying);
222
var third = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying);
ExpirationTests.cs (5)
38
guid0 = await cache.
GetOrCreateAsync
(key, callback, options);
41
Assert.Equal(guid0, await cache.
GetOrCreateAsync
(key, callback, options));
44
Assert.Equal(guid0, await cache.
GetOrCreateAsync
(key, callback, options));
47
Assert.Equal(guid0, await cache.
GetOrCreateAsync
(key, callback, options));
50
Assert.NotEqual(guid0, await cache.
GetOrCreateAsync
(key, callback, options));
FunctionalTests.cs (11)
26
Assert.Equal(42, await cache.
GetOrCreateAsync
(key, _ => new ValueTask<int>(42)));
30
Assert.Equal(42, await cache.
GetOrCreateAsync
(key, _ => new ValueTask<int>(96)));
34
Assert.Equal(96, await cache.
GetOrCreateAsync
(key, _ => new ValueTask<int>(96)));
42
Assert.Equal(42, await cache.
GetOrCreateAsync
(key, _ => new ValueTask<int>(42)));
46
Assert.Equal(42, await cache.
GetOrCreateAsync
(key, _ => new ValueTask<int>(96)));
54
Assert.Equal(42, await cache.
GetOrCreateAsync
(key, _ => new ValueTask<int>(42)));
58
Assert.Equal(42, await cache.
GetOrCreateAsync
(key, _ => new ValueTask<int>(96)));
62
Assert.Equal(96, await cache.
GetOrCreateAsync
(key, _ => new ValueTask<int>(96)));
70
Assert.Equal(42, await cache.
GetOrCreateAsync
(key, _ => new ValueTask<int>(42)));
73
Assert.Equal(42, await cache.
GetOrCreateAsync
(key, _ => new ValueTask<int>(96)));
77
Assert.Equal(96, await cache.
GetOrCreateAsync
(key, _ => new ValueTask<int>(96)));
RedisTests.cs (1)
75
await cache.
GetOrCreateAsync
<Guid>(key, _ =>
ServiceConstructionTests.cs (1)
95
var actual = await cache.
GetOrCreateAsync
(Me(), async _ => expected);
SizeTests.cs (10)
57
var actual = await cache.
GetOrCreateAsync
<string>(key!, ct => new(expected));
67
actual = await cache.
GetOrCreateAsync
<string>(key!, ct => new(Guid.NewGuid().ToString()));
124
var actual = await cache.
GetOrCreateAsync
<MutablePoco>(key!, ct => new(new MutablePoco { Value = expected }));
130
actual = await cache.
GetOrCreateAsync
<MutablePoco>(key!, ct => new(new MutablePoco { Value = Guid.NewGuid().ToString() }));
176
await Assert.ThrowsAsync<KnownFailureException>(async () => await cache.
GetOrCreateAsync
("key", func));
180
var first = await cache.
GetOrCreateAsync
("key", func);
181
var second = await cache.
GetOrCreateAsync
("key", func);
242
await Assert.ThrowsAsync<KnownFailureException>(async () => await cache.
GetOrCreateAsync
("key", func));
246
var first = await cache.
GetOrCreateAsync
("key", func);
247
var second = await cache.
GetOrCreateAsync
("key", func);
StampedeTests.cs (6)
99
results[i] = cache.
GetOrCreateAsync
(Me(), async ct =>
135
results[i] = cache.
GetOrCreateAsync
(Me(), async ct =>
188
results[i] = cache.
GetOrCreateAsync
(Me(), async ct =>
266
results[i] = cache.
GetOrCreateAsync
(Me(), async ct =>
340
var first = cache.
GetOrCreateAsync
(Me(), async ct =>
347
var second = cache.
GetOrCreateAsync
(Me(), async ct =>