namespace LootDumpProcessor.Storage.Implementations.Memory; public class MemoryDataStorage : IDataStorage { private static readonly Dictionary CachedObjects = new Dictionary(); private static readonly object _cacheObjectLock = new object(); public void Setup() { } public void Store(T t) where T : IKeyable { lock (_cacheObjectLock) { CachedObjects.Add(GetLookupKey(t.GetKey()), t); } } public bool Exists(IKey t) { lock (_cacheObjectLock) { return CachedObjects.ContainsKey(GetLookupKey(t)); } } public T? GetItem(IKey key) where T : IKeyable { lock (_cacheObjectLock) { if (CachedObjects.TryGetValue(GetLookupKey(key), out var value)) { return (T)value; } } return default; } public List GetAll() { throw new NotImplementedException(); } private string GetLookupKey(IKey key) { return string.Join("-", key.GetLookupIndex()); } }