Garnet is a remote cache-store from Microsoft Research that offers strong performance (throughput and latency), scalability, storage, recovery, cluster sharding, key migration, and replication features. Garnet can work with existing Redis clients. https://github.com/microsoft/garnet
天问 de68b63ee5 Update 'README.md' | 9 months ago | |
---|---|---|
README.md | 9 months ago |
Garnet is a remote cache-store from Microsoft Research that offers strong performance (throughput and latency), scalability, storage, recovery, cluster sharding, key migration, and replication features. Garnet can work with existing Redis clients.
微软基于 .net 开源的缓存数据库,对标 redis,可通过 redis-cli 各客户端连接, 代码非常简单
# 编译,输出到 /app 目录
dotnet restore
dotnet build -c Release
dotnet publish -c Release -o /app --self-contained false -f net8.0
sudo apt-get update
sudo apt-get install apt-transport-https
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/ubuntu/20.04/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update
sudo apt-get install dotnet-sdk-5.0
/app/GarnetServer -i 128m
服务器需要安装.net环境,最好通过docker部署:
# 或
docker compose -f docker-compose.yml up -d --build
C#中使用:
using Garnet;
try
{
using var server = new GarnetServer(args);
server.Start();
Thread.Sleep(Timeout.Infinite);
}
catch (Exception ex)
{
Console.WriteLine($"Unable to initialize server due to exception: {ex.Message}");
}
可轻易启动一个garent服务