All Projects → 2881099 → Freeredis

2881099 / Freeredis

Licence: mit
🦄 FreeRedis is .NET40+ redis client. supports cluster, sentinel, master-slave, pub-sub, lua, pipeline, transaction, streams, client-side-caching, and pooling.

Projects that are alternatives of or similar to Freeredis

redis-modules-java
Java client libraries for redis-modules https://redis.io/modules, based on Redisson. https://github.com/redisson/redisson
Stars: ✭ 57 (-85.93%)
Mutual labels:  redis-client
mruby-hiredis
mruby bindings for https://github.com/redis/hiredis
Stars: ✭ 12 (-97.04%)
Mutual labels:  redis-client
Redis Cpp17
redis-cpp17 is a cross platfrom compatible redis protocol with multithreaded c++17 client,server,proxy
Stars: ✭ 300 (-25.93%)
Mutual labels:  redis-client
racompass
An advanced GUI for Redis. Modern. Efficient. Fast. A faster and robust Redis management tool. For developers that need to manage data with confidence.It supports Redis modules now!
Stars: ✭ 26 (-93.58%)
Mutual labels:  redis-client
oxblood
A straightforward Redis Ruby library
Stars: ✭ 23 (-94.32%)
Mutual labels:  redis-client
Shineframe
高性能超轻量级C++开发库及服务器编程框架
Stars: ✭ 274 (-32.35%)
Mutual labels:  redis-client
grafana-redis-app
Redis Application for @grafana provides Application pages and custom panels for Redis Data Source.
Stars: ✭ 23 (-94.32%)
Mutual labels:  redis-client
Redis
Redis commands for Elixir
Stars: ✭ 357 (-11.85%)
Mutual labels:  redis-client
BeetleX.Redis
A high-performance async/non-blocking redis client components for dotnet core,default data formater json protobuf and messagepack,support ssl
Stars: ✭ 174 (-57.04%)
Mutual labels:  redis-client
Redisclient
Boost.asio based Redis-client library.
Stars: ✭ 289 (-28.64%)
Mutual labels:  redis-client
salad
Asynchronous Scala Redis Client supporting Sentinel and Redis Cluster
Stars: ✭ 14 (-96.54%)
Mutual labels:  redis-client
rcppredis
R interface to Redis using the hiredis library
Stars: ✭ 45 (-88.89%)
Mutual labels:  redis-client
Redisson
Redisson - Redis Java client with features of In-Memory Data Grid. Over 50 Redis based Java objects and services: Set, Multimap, SortedSet, Map, List, Queue, Deque, Semaphore, Lock, AtomicLong, Map Reduce, Publish / Subscribe, Bloom filter, Spring Cache, Tomcat, Scheduler, JCache API, Hibernate, MyBatis, RPC, local cache ...
Stars: ✭ 17,972 (+4337.53%)
Mutual labels:  redis-client
redistimeseries-py
RedisTimeSeries python client
Stars: ✭ 95 (-76.54%)
Mutual labels:  redis-client
Fastoredis
FastoRedis is a crossplatform Redis GUI management tool.
Stars: ✭ 316 (-21.98%)
Mutual labels:  redis-client
vredis
Redis client for V, written in V
Stars: ✭ 43 (-89.38%)
Mutual labels:  redis-client
Redisdesktopmanager Windows
RedisDesktopManager-Windows 安装包和编译教程
Stars: ✭ 268 (-33.83%)
Mutual labels:  redis-client
Lettuce Core
Advanced Java Redis client for thread-safe sync, async, and reactive usage. Supports Cluster, Sentinel, Pipelining, and codecs.
Stars: ✭ 4,319 (+966.42%)
Mutual labels:  redis-client
Crystal Redis
Full featured Redis client for Crystal
Stars: ✭ 345 (-14.81%)
Mutual labels:  redis-client
Xredis
Redis C++ client, support the data slice storage, support redis cluster, thread-safe,multi-platform,connection pool, read/write separation.
Stars: ✭ 285 (-29.63%)
Mutual labels:  redis-client

🦄 FreeRedis

FreeRedis is a redis client based on .NET, supports .NET Core 2.1+, .NET Framework 4.0+, and Xamarin.

nuget stats GitHub license

English | 中文

  • 🌈 RedisClient Keep all method names consistent with redis-cli
  • 🌌 Support Redis Cluster (requires redis-server 3.2 and above)
  • ⛳ Support Redis Sentinel
  • 🎣 Support Redis Master-Slave
  • 📡 Support Redis Pub-Sub
  • 📃 Support Redis Lua Scripting
  • 💻 Support Pipeline
  • 📰 Support Transaction
  • 🌴 Support Geo type commands (requires redis-server 3.2 and above)
  • 🌲 Support Streams type commands (requires redis-server 5.0 and above)
  • ⚡ Support Client-side-cahing (requires redis-server 6.0 and above)
  • 🌳 Support Redis 6 RESP3 Protocol

QQ Groups:4336577(full)、8578575(available)52508226(available)

🚀 Quick start

public static RedisClient cli = new RedisClient("127.0.0.1:6379,password=123,defaultDatabase=13");
//cli.Serialize = obj => JsonConvert.SerializeObject(obj);
//cli.Deserialize = (json, type) => JsonConvert.DeserializeObject(json, type);
cli.Notice += (s, e) => Console.WriteLine(e.Log); //print command log

cli.Set("key1", "value1");
cli.MSet("key1", "value1", "key2", "value2");

string value1 = cli.Get("key1");
string[] vals = cli.MGet("key1", "key2");

Supports strings, hashes, lists, sets, sorted sets, bitmaps, hyperloglogs, geo, streams And BloomFilter.

Parameter Default Explain
protocol RESP2 If you use RESP3, you need redis 6.0 environment
user <empty> Redis server username, requires redis-server 6.0
password <empty> Redis server password
defaultDatabase 0 Redis server database
max poolsize 100 Connection max pool size
min poolsize 5 Connection min pool size
idleTimeout 20000 Idle time of elements in the connection pool (MS), suitable for connecting to remote redis server
connectTimeout 10000 Connection timeout (MS)
receiveTimeout 10000 Receive timeout (MS)
sendTimeout 10000 Send timeout (MS)
encoding utf-8 string charset
retry 0 Protocol error retry execution times
ssl false Enable encrypted transmission
name <empty> Connection name, use client list command to view
prefix <empty> The prefix of the key, all methods will have this prefix. cli.Set(prefix + "key", 111);

IPv6: [fe80::b164:55b3:4b4f:7ce6%15]:6379

🎣 Master-Slave

public static RedisClient cli = new RedisClient(
    "127.0.0.1:6379,password=123,defaultDatabase=13",
    "127.0.0.1:6380,password=123,defaultDatabase=13",
    "127.0.0.1:6381,password=123,defaultDatabase=13"
    );

var value = cli.Get("key1");

Write data at 127.0.0.1:6379; randomly read data from port 6380 or 6381.

⛳ Redis Sentinel

public static RedisClient cli = new RedisClient(
    "mymaster,password=123", 
    new [] { "192.169.1.10:26379", "192.169.1.11:26379", "192.169.1.12:26379" },
    true //This variable indicates whether to use the read-write separation mode.
    );

🌌 Redis Cluster

Suppose, a Redis cluster has three master nodes (7001-7003) and three slave nodes (7004-7006), then use the following code to connect to the cluster:

public static RedisClient cli = new RedisClient(
    new ConnectionStringBuilder[] { "192.168.0.2:7001", "192.168.0.2:7002", "192.168.0.2:7003" }
    );

⚡ Client-side-cahing

requires redis-server 6.0 and above

cli.UseClientSideCaching(new ClientSideCachingOptions
{
    //Client cache capacity
    Capacity = 3,
    //Filtering rules, which specify which keys can be cached locally
    KeyFilter = key => key.StartsWith("Interceptor"),
    //Check long-term unused cache
    CheckExpired = (key, dt) => DateTime.Now.Subtract(dt) > TimeSpan.FromSeconds(2)
});

📡 Subscribe

using (cli.Subscribe("abc", ondata)) //wait .Dispose()
{
    Console.ReadKey();
}

void ondata(string channel, string data) =>
    Console.WriteLine($"{channel} -> {data}");

📃 Scripting

var r1 = cli.Eval("return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}", 
    new[] { "key1", "key2" }, "first", "second") as object[];

var r2 = cli.Eval("return {1,2,{3,'Hello World!'}}") as object[];

cli.Eval("return redis.call('set',KEYS[1],'bar')", 
    new[] { Guid.NewGuid().ToString() })

💻 Pipeline

using (var pipe = cli.StartPipe())
{
    pipe.IncrBy("key1", 10);
    pipe.Set("key2", Null);
    pipe.Get("key1");

    object[] ret = pipe.EndPipe();
    Console.WriteLine(ret[0] + ", " + ret[2]);
}

📰 Transaction

using (var tran = cli.Multi())
{
    tran.IncrBy("key1", 10);
    tran.Set("key2", Null);
    tran.Get("key1");

    object[] ret = tran.Exec();
    Console.WriteLine(ret[0] + ", " + ret[2]);
}

📯 GetDatabase: switch database

using (var db = cli.GetDatabase(10))
{
    db.Set("key1", 10);
    var val1 = db.Get("key1");
}

🔍 Scan

Support cluster mode

foreach (var keys in cli.Scan("*", 10, null))
{
    Console.WriteLine(string.Join(", ", keys));
}

👯 Contributors

💕 Donation

Thank you for your donation

🗄 License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].