Remove all dependencies on redis
This commit is contained in:
parent
2e501008df
commit
33b17b373f
11 changed files with 129 additions and 77 deletions
32
Geekbot.net/Lib/KvInMemoryStore/KvInMemoryStore.cs
Normal file
32
Geekbot.net/Lib/KvInMemoryStore/KvInMemoryStore.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue