diff --git a/src/BuildingRegistry.Cache.Invalidator/RedisCacheInvalidateService.cs b/src/BuildingRegistry.Cache.Invalidator/RedisCacheInvalidateService.cs index 7eaa5327d..b26eb247d 100644 --- a/src/BuildingRegistry.Cache.Invalidator/RedisCacheInvalidateService.cs +++ b/src/BuildingRegistry.Cache.Invalidator/RedisCacheInvalidateService.cs @@ -22,8 +22,16 @@ internal sealed class RedisCacheInvalidateService: IRedisCacheInvalidateService public RedisCacheInvalidateService(IConfiguration configuration) { - _cacheKeyFormats = configuration.GetValue("RedisCacheKeyFormats") - ?? throw new ArgumentException("No 'RedisCacheKeyFormats' configuration found"); + _cacheKeyFormats = configuration.GetSection("RedisCacheKeyFormats") + .GetChildren() + .Select(c => c.Value!) + .ToArray(); + + if (_cacheKeyFormats.Length == 0) + { + throw new ArgumentException("No 'RedisCacheKeyFormats' configuration found"); + } + _connectionString = configuration.GetConnectionString("LastChangedList") ?? throw new ArgumentException("No connectionstring 'LastChangedList' found"); }