Ejemplo n.º 1
0
 public static void CheckPool <T>(ClientPool2 <T> value) where T : RedisClientBase, new()
 {
     Console.WriteLine($"===========Poo1 : {typeof(T).Name}==========");
     for (int i = 0; i < value.CallCounter.Length; i++)
     {
         Console.WriteLine($"No.{i} used {value.CallCounter[i]}");
     }
 }
Ejemplo n.º 2
0
        private static void InitClient()
        {
            //_useDelay = true;
            _delayCount = 3000;
            //Notice : Please use "//" comment "/*".

            ///*
            using (StreamReader stream = new StreamReader("Redis.rsf"))
            {
                ip   = stream.ReadLine();
                port = int.Parse(stream.ReadLine());
                //pwd = stream.ReadLine();
            }//*/

            /*
             * ip = "127.0.0.1";
             * port = 6379;
             * //*/

            // NewLife.Redis
            // _newLifeRedis = new NewLife.Caching.Redis($"{ip}:{port}",null, 1);
            //var result = newLifeRedis.Set("1", "1");
            //Console.WriteLine(result);
            //Console.ReadKey();
            //_beetleClient = new BeetleX.Redis.RedisDB(0);
            //var host = _beetleClient.Host.AddWriteHost(ip, port);
            //host.MaxConnections = 1000;
            //host.QueueMaxLength = 512;
            //_freeRedisClient = new RedisClient($"{ip}:{port},database=0,min pool size=100");
            //_redisClient0 = new NewRedisClient0(ip, port);

            _pool4        = new ClientPool1 <NewRedisClient4>(ip, port);
            _pool5        = new ClientPool1 <NewRedisClient5>(ip, port);
            _pool7        = new ClientPool1 <NewRedisClient7>(ip, port);
            _pool27       = new ClientPool2 <NewRedisClient7>(ip, port);
            _pool25       = new ClientPool2 <NewRedisClient5>(ip, port);
            _pool24       = new ClientPool2 <NewRedisClient4>(ip, port);
            _redisClient1 = new NewRedisClient1(ip, port);
            _redisClient2 = new NewRedisClient2(ip, port);
            _redisClient3 = new NewRedisClient3(ip, port);
            _redisClient4 = _pool4._node;
            _redisClient5 = _pool5._node;
            _redisClient7 = _pool7._node;
            _redisClient8 = new NewRedisClient8();
            _redisClient8.CreateConnection(ip, port);
            _redisClient9 = new NewRedisClient9();
            _redisClient9.CreateConnection(ip, port);
            //_redisClient5.SetAsync("a", "a");
            ConnectionMultiplexer seredis = ConnectionMultiplexer.Connect($"{ip}:{port}");

            _stackExnchangeClient = seredis.GetDatabase(0);
        }