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
var cache = new CachingService
{
DefaultCachePolicy = {DefaultCacheDurationSeconds = 1}
};
var res1 = await cache.GetOrAddAsync("foo", async x => DateTime.UtcNow.Second);
// wait for the item to expire
await Task.Delay(TimeSpan.FromSeconds(2));
// same key
var res2 = await cache.GetOrAddAsync("foo", async x => DateTime.UtcNow.Second);
// new key
var res3 = await cache.GetOrAddAsync("bar", async x => DateTime.UtcNow.Second);
Console.WriteLine(res1);
Console.WriteLine(res2);
Console.WriteLine(res3);
Expected behavior
A new value generated for each call, with output e.g.
23
25
25
Actual behavior
Same value reused for "foo", with output e.g.
23
23
25
Framework and Platform
OS: Windows 10
Framework net5.0
LazyCache Version 2.1.3
Additional context
Similar to the report in #121, although this isn't because of lazy eviction
The text was updated successfully, but these errors were encountered:
Describe the bug
DefaultCacheDurationSeconds is being ignored in some code paths. It only appears to be used in
AppCacheExtensions
e.g. extensionLazyCache/LazyCache/AppCacheExtensions.cs
Line 74 in e38695b
LazyCache/LazyCache/CachingService.cs
Line 182 in 33d055c
To Reproduce
Expected behavior
A new value generated for each call, with output e.g.
Actual behavior
Same value reused for
"foo"
, with output e.g.Framework and Platform
Additional context
Similar to the report in #121, although this isn't because of lazy eviction
The text was updated successfully, but these errors were encountered: