Skip to content

Commit

Permalink
Change configuration objects to have stricter set policy.
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelJCamara committed Aug 21, 2023
1 parent acaad6b commit 71f7abf
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/Nebula.Caching.Common/Settings/BaseOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Common.Settings
public abstract class BaseOptions
{
public virtual string ConfigurationRoot { get; set; } = "";
public virtual IDictionary<string, TimeSpan> CacheSettings { get; set; } = new ConcurrentDictionary<string, TimeSpan>();
public virtual IDictionary<string, TimeSpan> CacheGroupSettings { get; set; } = new ConcurrentDictionary<string, TimeSpan>();
public virtual IDictionary<string, TimeSpan> CacheSettings { get; init; } = new ConcurrentDictionary<string, TimeSpan>();
public virtual IDictionary<string, TimeSpan> CacheGroupSettings { get; init; } = new ConcurrentDictionary<string, TimeSpan>();
}
}
4 changes: 2 additions & 2 deletions src/Nebula.Caching.Common/Settings/Configurations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Nebula.Caching.Common.Settings
{
public class Configurations
{
public string ConfigurationSection { get; set; } = CacheConfigurationConstants.ConfigurationSection;
public int DefaultCacheDurationInSeconds { get; set; } = CacheDurationConstants.DefaultCacheDurationInSeconds;
public string ConfigurationSection { get; init; } = CacheConfigurationConstants.ConfigurationSection;
public int DefaultCacheDurationInSeconds { get; init; } = CacheDurationConstants.DefaultCacheDurationInSeconds;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Nebula.Caching.Common.Settings;

namespace Nebula.Caching.InMemory.Settings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Nebula.Caching.Common.Settings;

namespace Nebula.Caching.MemCached.Settings
Expand Down
2 changes: 1 addition & 1 deletion src/Nebula.Caching.Memcached/Settings/MemCachedOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Nebula.Caching.MemCached.Settings
{
public class MemCachedOptions : BaseOptions
{
public string CacheServiceUrl { get; set; } = "";
public string CacheServiceUrl { get; init; } = "";
public override string ConfigurationRoot { get; set; } = "MemCached";
}
}
2 changes: 1 addition & 1 deletion src/Nebula.Caching.Redis/Settings/RedisConfigurations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Nebula.Caching.Redis.Settings
{
public class RedisConfigurations : Configurations
{
public RedisConfigurationFlavour ConfigurationFlavour { get; set; }
public RedisConfigurationFlavour ConfigurationFlavour { get; init; }
public Action<ConfigurationOptions>? Configure { get; set; }
public ConfigurationOptions? Configuration { get; set; }
public TextWriter? Log { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Nebula.Caching.Redis/Settings/RedisOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Redis.Settings
{
public class RedisOptions : BaseOptions
{
public string CacheServiceUrl { get; set; } = "";
public string CacheServiceUrl { get; init; } = "";
public override string ConfigurationRoot { get; set; } = "Redis";
}
}

0 comments on commit 71f7abf

Please sign in to comment.