Skip to content

Commit

Permalink
chore: minor refactor (#583)
Browse files Browse the repository at this point in the history
  • Loading branch information
oskogstad authored Apr 3, 2024
1 parent fa610d5 commit 3080902
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi
services.AddDistributedMemoryCache();
}

ConfigureFusionCache(services, nameof(Altinn.NameRegistry), new()
services.ConfigureFusionCache(nameof(Altinn.NameRegistry), new()
{
Duration = TimeSpan.FromDays(1),
});
ConfigureFusionCache(services, nameof(Altinn.ResourceRegistry), new()
})
.ConfigureFusionCache(nameof(Altinn.ResourceRegistry), new()
{
Duration = TimeSpan.FromMinutes(20),
});
ConfigureFusionCache(services, nameof(Altinn.OrganizationRegistry), new()
})
.ConfigureFusionCache(nameof(Altinn.OrganizationRegistry), new()
{
Duration = TimeSpan.FromDays(1),
});
Expand Down Expand Up @@ -196,11 +196,11 @@ private static IHttpClientBuilder AddMaskinportenHttpClient<TClient, TImplementa
.AddMaskinportenHttpMessageHandler<TClientDefinition, TClient>(configureClientDefinition);
}

private static void ConfigureFusionCache(IServiceCollection services, string cacheName, FusionCacheSettings? settings = null)
private static IServiceCollection ConfigureFusionCache(this IServiceCollection services, string cacheName, FusionCacheSettings? settings = null)
{
settings ??= new FusionCacheSettings();

var fusionCacheConfig = services.AddFusionCache(cacheName)
services.AddFusionCache(cacheName)
.WithOptions(options =>
{
options.DistributedCacheCircuitBreakerDuration = TimeSpan.FromSeconds(2);
Expand All @@ -227,5 +227,7 @@ private static void ConfigureFusionCache(IServiceCollection services, string cac
.WithRegisteredSerializer()
.WithRegisteredDistributedCache()
.WithRegisteredBackplane();

return services;
}
}

0 comments on commit 3080902

Please sign in to comment.