internal static async Task <RedisClient> ConnectAsync(RedisClientConfig redisClientConfig, CancellationToken cancellationToken)
        {
            var redisClient = new RedisClient(redisClientConfig);
            await redisClient.TryConnectAsync(cancellationToken);

            return(redisClient);
        }
Пример #2
0
        public RedisClientManager(RedisClientConfig clientConfig, int redisClientPoolSize)
        {
            if (redisClientPoolSize < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(redisClientPoolSize), "Pool size must be 1 or more");
            }

            ClientConfig = clientConfig;

            for (var i = 0; i < redisClientPoolSize; i++)
            {
                _redisClients.Add(RedisClient.ConnectAsync(clientConfig));
            }
        }
 protected RedisClient(RedisClientConfig redisClientConfig) : this()
 {
     ClientConfig = redisClientConfig ?? throw new ArgumentNullException(nameof(redisClientConfig));
     //_connectionChecker = new Timer(CheckConnection, null, 30000, 30000);
 }
 internal static Task <RedisClient> ConnectAsync(RedisClientConfig redisClientConfig)
 {
     return(ConnectAsync(redisClientConfig, CancellationToken.None));
 }