Insvald / Slik

Distributed In-process Cache; a gRPC HTTP proxy for containerd
MIT License
20 stars 6 forks source link
cache cluster cluster-members containerd csharp distributed distributedcache net50 net60 proxy raft slik

Build Integration tests Nuget The current version of Slik.Cache Slik.Cache uses MIT License

Slik.Cache

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.

Sample project: examples/SlikNode

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

Roadmap

Slik.Cord tests

Slik.Cord

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.

Usage

Run SlikCord (preferably in a container). Connect to port 80 from any client with gRPC support using the regular containerd API.

Roadmap