You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MemoryCache.CreateEntry not creating anything in cache.
Configuration
Windows 10
.net 50
NUnit project
Microsoft.Extensions.Caching.Memory 5.0.0 from nuget
Other information
[Test]
public async Task CacheTest()
{
var cache = new MemoryCache(new MemoryCacheOptions());
cache.CreateEntry("foo").SetValue("bar").SetAbsoluteExpiration(TimeSpan.FromSeconds(100));
string result;
Assert.IsTrue(cache.TryGetValue("foo", out result)); //this will fail
}
Update 1:
Looking in decompiled code I see it requires for entry to be disposed. Is there some reason why it doesn't have more explanatory Commit/Apply/Configure+Build methods?
Also, no documentation has been found by me for this one.
The text was updated successfully, but these errors were encountered:
MemoryCache.CreateEntry not creating anything in cache.
Configuration
.net 50
NUnit project
Other information
[Test]
public async Task CacheTest()
{
var cache = new MemoryCache(new MemoryCacheOptions());
cache.CreateEntry("foo").SetValue("bar").SetAbsoluteExpiration(TimeSpan.FromSeconds(100));
string result;
Assert.IsTrue(cache.TryGetValue("foo", out result));
}
Looking in decompiled code I see it requires for entry to be disposed.
This is correct. It was not an ideal design from the start, but since it has shipped for multiple versions, we can't make a breaking change any longer.
Description
MemoryCache.CreateEntry not creating anything in cache.
Configuration
Windows 10
.net 50
NUnit project
Microsoft.Extensions.Caching.Memory 5.0.0 from nuget
Other information
Update 1:
Looking in decompiled code I see it requires for entry to be disposed. Is there some reason why it doesn't have more explanatory Commit/Apply/Configure+Build methods?
Also, no documentation has been found by me for this one.
The text was updated successfully, but these errors were encountered: