Remove all dependencies on redis

This commit is contained in:
runebaas 2020-05-30 17:02:17 +02:00
parent 2e501008df
commit 33b17b373f
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
11 changed files with 129 additions and 77 deletions

View file

@ -0,0 +1,32 @@
using System.Collections.Generic;
namespace Geekbot.net.Lib.KvInMemoryStore
{
public class KvInInMemoryStore : IKvInMemoryStore
{
private readonly Dictionary<string, object> _storage = new Dictionary<string, object>();
public T Get<T>(string key)
{
try
{
return (T) _storage[key];
}
catch
{
return default;
}
}
public void Set<T>(string key, T value)
{
_storage.Remove(key);
_storage.Add(key, value);
}
public void Remove(string key)
{
_storage.Remove(key);
}
}
}