static void Main4(string[] args) { var redisPool = RoundRobinSSRedisPool.Create().CuratorClient("192.168.4.77:2181", 5000).ZkProxyDir("codis-zxf") .Build(); //使用连接池查询 using (var redisClient = redisPool.GetClient()) { redisClient.Db = 5; var value = redisClient.Get <string>("k1"); log.InfoFormat("查询redis:k1={0}", value); } //直接查询 using (RedisClient redisClient = new RedisClient("192.168.4.79", 6379)) { redisClient.Db = 5; var value = redisClient.Get <string>("k1"); log.InfoFormat("查询redis:k1={0}", value); } Console.ReadKey(); }
static RedisPoolManager() { //redisPool = RoundRobinSSRedisPool.Create().CuratorClient("192.168.4.144:20000", 5000).ZkProxyDir("mango").Build(); redisPool = RoundRobinSSRedisPool.Create().CuratorClient("192.168.4.77:2181,192.168.4.78:2181,192.168.4.79:2181", 5000).ZkProxyDir("codis-mango").Build(); }