コード例 #1
0
        internal static async Task <RedisClient> ConnectAsync(RedisClientConfig redisClientConfig, CancellationToken cancellationToken)
        {
            var redisClient = new RedisClient(redisClientConfig);
            await redisClient.TryConnectAsync(cancellationToken).ConfigureAwait(false);

            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));
            }
        }
コード例 #3
0
 protected RedisClient(RedisClientConfig redisClientConfig) : this()
 {
     ClientConfig       = redisClientConfig ?? throw new ArgumentNullException(nameof(redisClientConfig));
     _connectionChecker = new Timer(CheckConnection, null, 2500, 250);
 }
コード例 #4
0
 internal static Task <RedisClient> ConnectAsync(RedisClientConfig redisClientConfig)
 {
     return(ConnectAsync(redisClientConfig, CancellationToken.None));
 }