From a79aa8237fcca6593231a26ae4928aea18867090 Mon Sep 17 00:00:00 2001 From: Jody Donetti Date: Sat, 20 Apr 2024 17:54:10 +0200 Subject: [PATCH] Better null checking for options inbuilder (1 less check in happy path) --- .../Internals/Builder/FusionCacheBuilder.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ZiggyCreatures.FusionCache/Internals/Builder/FusionCacheBuilder.cs b/src/ZiggyCreatures.FusionCache/Internals/Builder/FusionCacheBuilder.cs index 436a066e..0c0b1f17 100644 --- a/src/ZiggyCreatures.FusionCache/Internals/Builder/FusionCacheBuilder.cs +++ b/src/ZiggyCreatures.FusionCache/Internals/Builder/FusionCacheBuilder.cs @@ -99,14 +99,17 @@ public IFusionCache Build(IServiceProvider serviceProvider) } } - options ??= Options; - if (options is null) { - options = new FusionCacheOptions() + options = Options; + + if (options is null) { - CacheName = CacheName - }; + options = new FusionCacheOptions() + { + CacheName = CacheName + }; + } } SetupOptionsAction?.Invoke(options);