Distributed In-process Cache in C# and Net 5.0/6.0 with external gRPC API (HTTP/2, client/server certificates)
Based on a magnificent dotNext library and its Raft cluster implementation.
Implements IDistributedCache, a standard interface for .Net Core cache.
Simple initialization:
await Host
.CreateDefaultBuilder()
.UseSlik(new SlikOptions
{
Host = new IPEndPoint(IPAddress.Loopback, 3092),
Members = new[] { "localhost:3092", "localhost:3093", "localhost:3094" }
})
.Build()
.RunAsync();
Usage:
public class CacheConsumer
{
private readonly IDistributedCache _cache;
public CacheConsumer(IDistributedCache cache)
{
_cache = cache;
_cache.SetString("Greeting", "Hello, world");
}
//...
}
Update any node, updates are redirected to a cluster leader, and are replicated automatically to each node.
How to run a minimal cluster:
SlikNode --port=3092 --folder="node 1" --members=localhost:3092,localhost:3093,localhost:3094
SlikNode --port=3093 --folder="node 2" --members=localhost:3092,localhost:3093,localhost:3094
SlikNode --port=3094 --folder="node 3" --members=localhost:3092,localhost:3093,localhost:3094
A gRPC HTTP proxy for containerd in C# and Net 5.0/6.0. Containerd API works locally via Unix domain socket (in Linux) or named pipe (in Windows), not allowing to connect to it from another computer/container. This proxy can solve the problem. Current implementation doesn't work on Windows.
Run SlikCord (preferably in a container). Connect to port 80 from any client with gRPC support using the regular containerd API.