ZiggyCreatures / FusionCache

FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features.
MIT License
1.65k stars 87 forks source link

[BUG] NullFusionCache throws when setupAction is used #168

Closed kelko closed 11 months ago

kelko commented 1 year ago

Describe the bug

NullFusionCache.CreateEntryOptions throws "NotImplementedException"

To Reproduce

// variant 1
var cache1 = new NullFusionCache(new FusionCacheOptions());
var result1 = await cache1.GetOrSetAsync<bool>(
    "some-name",
    (ctx, ct) => Task.FromResult(true),
    options => options.SetDuration(TimeSpan.FromSeconds(1)));

// variant 2
var cache2 = new NullFusionCache(new FusionCacheOptions());
var result2 = await cache2.GetOrSetAsync<bool>(
    "some-name",
    ct => Task.FromResult(true),
    options => options.SetDuration(TimeSpan.FromSeconds(1)));

Expected behavior

GetOrSetAsync with provided setupAction passes the result from factory through the same way the version without setupAction does.

Versions FusionCache: 0.23.0 .NET 6

jodydonetti commented 1 year ago

Hi @kelko , the thing is:

image

So yeah, what can I say? I'm dumb 😅

Sorry about that, I'll fix it in the next release.

jodydonetti commented 1 year ago

Hi all, the v0.24.0-preview1 pre-release is out now on Nuget 🎉

NOTE: remember to check the "include prerelease" checkbox in your IDE to see it!

jodydonetti commented 11 months ago

Hi @kelko , have you been able to try the new version with the fix?

Thanks!

kelko commented 11 months ago

Hey @jodydonetti Sorry for the delay. I checked the preview1 for 0.24.0 and can confirm, that my test now successfully work with the NullFusionCache

jodydonetti commented 11 months ago

Great, thanks!