Пример #1
0
        protected RedisClient GetSingleNodeClient()
        {
            // try to hit all lines in the config classes
            var mcc = new RedisClientConfiguration();
            var server = new EndPointConfiguration(new IPEndPoint(IPAddress.Loopback, 6379));
            mcc.Servers.Add(server);

            mcc.NodeLocator = typeof(SingleNodeLocator);
            mcc.KeyTransformer = typeof(DefaultKeyTransformer);
            mcc.Transcoder = typeof(DefaultTranscoder);

            mcc.SocketPool.MinPoolSize = 10;
            mcc.SocketPool.MaxPoolSize = 100;
            mcc.SocketPool.ConnectionTimeout = new TimeSpan(0, 0, 10);
            mcc.SocketPool.DeadTimeout = new TimeSpan(0, 0, 30);
            return new RedisClient(mcc);
        }
Пример #2
0
        public void ProgrammaticConfigurationTest()
        {
            // try to hit all lines in the config classes
            var mcc = new RedisClientConfiguration();

            mcc.Servers.Add(new EndPointConfiguration(new IPEndPoint(IPAddress.Loopback, 20000)));
            mcc.Servers.Add(new EndPointConfiguration(new IPEndPoint(IPAddress.Loopback, 20002)));

            mcc.NodeLocator = typeof(DefaultNodeLocator);
            mcc.KeyTransformer = typeof(SHA1KeyTransformer);
            mcc.Transcoder = typeof(DefaultTranscoder);

            mcc.SocketPool.MinPoolSize = 10;
            mcc.SocketPool.MaxPoolSize = 100;
            mcc.SocketPool.ConnectionTimeout = new TimeSpan(0, 0, 10);
            mcc.SocketPool.DeadTimeout = new TimeSpan(0, 0, 30);

            using (new RedisClient(mcc)) ;
        }