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
Describe the bug
Creating two separate instances of LazyCache, using default constructor will share the same underlying memory.
I'm not sure if this is a bug or by design, but it clearly violates the principle of least surprise :)
To Reproduce
using LazyCache;
// First cache
var cache1 = new CachingService();
cache1.GetOrAdd("key1", () => "value1");
// Another cache
var cache2 = new CachingService();
var value = cache2.Get<string>("key1");
Console.WriteLine(value);
// Expected value: null
// Actual value: "value1"
Expected behavior
Creating two instances of LazyCache using default constructors, should not share the underlying cache.
** Framework and Platform **
OS: [Everything]
Framework [NET8]
LazyCache Version [e.g. 2.4.0]
Additional context
Culprit seems to be this static:
Describe the bug
Creating two separate instances of LazyCache, using default constructor will share the same underlying memory.
I'm not sure if this is a bug or by design, but it clearly violates the principle of least surprise :)
To Reproduce
Expected behavior
Creating two instances of LazyCache using default constructors, should not share the underlying cache.
** Framework and Platform **
Additional context
Culprit seems to be this static:
LazyCache/LazyCache/CachingService.cs
Line 42 in 633b570
The text was updated successfully, but these errors were encountered: