/* 连接字符串格式
* localhost
* 127.0.0.1:6379
* redis://localhost:6379
* password@localhost:6379
* clientid:password@localhost:6379
* redis://clientid:password@localhost:6380?ssl=true&db=1
*/
var redis_servre = "192.168.1.104:6379";
var redis_channel = "test@#";
var channel_exit = "exit";
2. 建立redis连接池
1
2
3
4
5
6
7
8
var rwHosts = new string[] { redis_servre };
var rHosts = new string[] { };
var redisPool = new PooledRedisClientManager(rwHosts, rHosts, new RedisClientManagerConfig()
{
MaxWritePoolSize = 5,
MaxReadPoolSize = 5,
AutoStart = true
});