26 lines
731 B
C#
26 lines
731 B
C#
using System;
|
|
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Kreta.Framework.Caching
|
|
{
|
|
internal sealed class ManualEnumCache : Cache
|
|
{
|
|
private ConcurrentDictionary<string, Dictionary<string, string>> cache;
|
|
|
|
public ManualEnumCache(CacheManager cacheManager) : base(cacheManager)
|
|
{
|
|
cache = new ConcurrentDictionary<string, Dictionary<string, string>>();
|
|
}
|
|
|
|
public Dictionary<string, string> GetOrAdd(string key, Func<string, Dictionary<string, string>> valueFactory)
|
|
{
|
|
return cache.GetOrAdd(key, valueFactory);
|
|
}
|
|
|
|
public override void Reset()
|
|
{
|
|
cache.Clear();
|
|
}
|
|
}
|
|
}
|