Example #1
0
        /// <summary>
        /// 获取连接池客户端
        /// </summary>
        /// <returns></returns>
        public RedisDb GetPoolClient(string redisHost, int maxWritePoolSize, int maxReadPoolSize)
        {
            var redisclient = (RedisClient)GetPool(new RedisConfig(redisHost)
            {
                MaxReadPoolSize = maxReadPoolSize, MaxWritePoolSize = maxWritePoolSize
            }).GetClient();
            RedisDb db = new RedisDb(redisclient);

            return(db);
        }
Example #2
0
        /// <summary>
        /// 独立创建一个客户端
        /// </summary>
        /// <param name="hostip"></param>
        /// <param name="port"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public RedisDb CreateClient(string hostip, int port, string password)
        {
            var client = new RedisClient(hostip, port);

            if (!string.IsNullOrEmpty(password))
            {
                client.Password = password;
            }
            RedisDb db = new RedisDb(client);

            return(db);
        }