Fixed issue where singleton configuration cache was blocking creation of new components
This commit is contained in:
@@ -2,16 +2,17 @@
|
||||
|
||||
namespace Toolkit.Foundation;
|
||||
|
||||
public static class ConfigurationCache
|
||||
public class ConfigurationCache :
|
||||
IConfigurationCache
|
||||
{
|
||||
private static readonly ConcurrentDictionary<string, object?> cache = new();
|
||||
private readonly ConcurrentDictionary<string, object?> cache = new();
|
||||
|
||||
public static void Set<TConfiguration>(string section,
|
||||
public void Set<TConfiguration>(string section,
|
||||
TConfiguration configuration) => cache[section] = configuration;
|
||||
|
||||
public static bool Remove(string section) => cache.TryRemove(section, out _);
|
||||
public bool Remove(string section) => cache.TryRemove(section, out _);
|
||||
|
||||
public static bool TryGet<TConfiguration>(string section,
|
||||
public bool TryGet<TConfiguration>(string section,
|
||||
out TConfiguration? configuration)
|
||||
{
|
||||
if (cache.TryGetValue(section, out object? cachedValue))
|
||||
|
||||
Reference in New Issue
Block a user