32 references to GetOrCreateAsync
Microsoft.Extensions.Caching.Hybrid.Tests (32)
BufferReleaseTests.cs (9)
39
var first = await cache.
GetOrCreateAsync
(key, _ => GetAsync());
51
var second = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying);
57
var third = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying);
130
var first = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying); // we expect this to come from L2, hence NoUnderlying
142
var second = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying);
148
var third = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying);
189
var first = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying); // we expect this to come from L2, hence NoUnderlying
201
var second = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying);
207
var third = await cache.
GetOrCreateAsync
(key, _ => GetAsync(), _noUnderlying);
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 (4)
28
var actual = await cache.
GetOrCreateAsync
<string>(Key, ct => new(expected));
38
actual = await cache.
GetOrCreateAsync
<string>(Key, ct => new(Guid.NewGuid().ToString()));
71
var actual = await cache.
GetOrCreateAsync
<MutablePoco>(Key, ct => new(new MutablePoco { Value = expected }));
77
actual = await cache.
GetOrCreateAsync
<MutablePoco>(Key, ct => new(new MutablePoco { Value = Guid.NewGuid().ToString() }));
StampedeTests.cs (6)
81
results[i] = cache.
GetOrCreateAsync
(Me(), async ct =>
117
results[i] = cache.
GetOrCreateAsync
(Me(), async ct =>
170
results[i] = cache.
GetOrCreateAsync
(Me(), async ct =>
248
results[i] = cache.
GetOrCreateAsync
(Me(), async ct =>
322
var first = cache.
GetOrCreateAsync
(Me(), async ct =>
329
var second = cache.
GetOrCreateAsync
(Me(), async ct =>