Exemplo n.º 1
0
 public void Connect(RedisConnectionStringBuilder connectionString)
 {
     _client = new RedisClientAsync(((IPEndPoint)connectionString.EndPoint).Address.ToString(),
                                    ((IPEndPoint)connectionString.EndPoint).Port, 10000);
     _syncClient = new ctstone.Redis.RedisClient(((IPEndPoint)connectionString.EndPoint).Address.ToString(),
                                                 ((IPEndPoint)connectionString.EndPoint).Port, 10000);
 }
Exemplo n.º 2
0
 public void Connect(RedisConnectionStringBuilder connectionString)
 {
     _client = new RedisClientAsync(((IPEndPoint) connectionString.EndPoint).Address.ToString(),
                                                  ((IPEndPoint) connectionString.EndPoint).Port, 10000);
     _syncClient = new ctstone.Redis.RedisClient(((IPEndPoint) connectionString.EndPoint).Address.ToString(),
                                                  ((IPEndPoint) connectionString.EndPoint).Port, 10000);
 }
Exemplo n.º 3
0
        async static Task Test2Async()
        {
            var RedisClient = new RedisClientAsync();
            await RedisClient.Connect("localhost", 6379);

            Console.WriteLine((await RedisClient.Command("set", "hello-csharp", "999")).ToJson());
            Console.WriteLine((await RedisClient.Command("get", "hello-csharp")).ToJson());
        }
Exemplo n.º 4
0
        public async Task _CommandTestAsync()
        {
            var RedisClient = new RedisClientAsync();

            /*
             * await RedisClient.Connect("localhost", 6379);
             * Console.WriteLine((await RedisClient.Command("set", "hello-csharp", "1")).ToJson());
             * Console.WriteLine((await RedisClient.Command("get", "hello-csharp")).ToJson());
             */
        }
Exemplo n.º 5
0
        public void Initialize()
        {
            Host     = ConfigurationManager.AppSettings["host"];
            Port     = Int32.Parse(ConfigurationManager.AppSettings["port"]);
            Password = ConfigurationManager.AppSettings["password"];

            _redis = new Lazy <RedisClient>(() =>
            {
                RedisClient redis = new RedisClient(Host, Port, 0);
                redis.Auth(Password);
                return(redis);
            });

            _async = new Lazy <RedisClientAsync>(() =>
            {
                RedisClientAsync async = new RedisClientAsync(Host, Port, 0);
                async.Auth(Password).Wait();
                return(async);
            });
        }
Exemplo n.º 6
0
        public void Initialize()
        {
            Host = ConfigurationManager.AppSettings["host"];
            Port = Int32.Parse(ConfigurationManager.AppSettings["port"]);
            Password = ConfigurationManager.AppSettings["password"];

            _redis = new Lazy<RedisClient>(() =>
            {
                RedisClient redis = new RedisClient(Host, Port, 0);
                redis.Auth(Password);
                return redis;
            });

            _async = new Lazy<RedisClientAsync>(() =>
            {
                RedisClientAsync async = new RedisClientAsync(Host, Port, 0);
                async.Auth(Password).Wait();
                return async;
            });
        }
Exemplo n.º 7
0
 public RedisTestKeys(RedisClientAsync async, params string[] keys)
 {
     _async = async;
     _keys = keys;
     _async.Del(keys).Wait();
 }
Exemplo n.º 8
0
 public RedisTestKeys(RedisClientAsync async, params string[] keys)
 {
     _async = async;
     _keys  = keys;
     _async.Del(keys).Wait();
 }