Exemple #1
0
        public PooledRedisClientManager(
            IEnumerable <string> readWriteHosts,
            IEnumerable <string> readOnlyHosts,
            RedisClientManagerConfig config,
            int initalDb)
        {
            this.Db = config != null
                                ? config.DefaultDb.GetValueOrDefault(initalDb)
                                : initalDb;

            ReadWriteHosts = readWriteHosts.ToIpEndPoints();
            ReadOnlyHosts  = readOnlyHosts.ToIpEndPoints();

            this.RedisClientFactory = Redis.RedisClientFactory.Instance;

            this.Config = config ?? new RedisClientManagerConfig {
                MaxWritePoolSize = ReadWriteHosts.Count * PoolSizeMultiplier,
                MaxReadPoolSize  = ReadOnlyHosts.Count * PoolSizeMultiplier,
            };

            if (this.Config.AutoStart)
            {
                this.OnStart();
            }
        }
Exemple #2
0
 /// <summary>
 /// Hosts can be an IP Address or Hostname in the format: host[:port]
 /// e.g. 127.0.0.1:6379
 /// default is: localhost:6379
 /// </summary>
 /// <param name="readWriteHosts">The write hosts.</param>
 /// <param name="readOnlyHosts">The read hosts.</param>
 /// <param name="config">The config.</param>
 public PooledRedisClientManager(
     IEnumerable <string> readWriteHosts,
     IEnumerable <string> readOnlyHosts,
     RedisClientManagerConfig config)
     : this(readWriteHosts, readOnlyHosts, config, RedisNativeClient.DefaultDb)
 {
 }
		/// <summary>
		/// Hosts can be an IP Address or Hostname in the format: host[:port]
		/// e.g. 127.0.0.1:6379
		/// default is: localhost:6379
		/// </summary>
		/// <param name="readWriteHosts">The write hosts.</param>
		/// <param name="readOnlyHosts">The read hosts.</param>
		/// <param name="config">The config.</param>
		public PooledRedisClientManager(
			IEnumerable<string> readWriteHosts,
			IEnumerable<string> readOnlyHosts,
			RedisClientManagerConfig config)
			: this(readWriteHosts, readOnlyHosts, config, RedisNativeClient.DefaultDb)
		{
		}
Exemple #4
0
        public PooledRedisClientManager(
            IEnumerable <string> readWriteHosts,
            IEnumerable <string> readOnlyHosts,
            RedisClientManagerConfig config,
            long initalDb,
            int?poolSizeMultiplier,
            int?poolTimeOutSeconds)
        {
            this.Db = config != null
                ? config.DefaultDb.GetValueOrDefault(initalDb)
                : initalDb;

            ReadWriteHosts = readWriteHosts.ToRedisEndPoints();
            ReadOnlyHosts  = readOnlyHosts.ToRedisEndPoints();

            this.RedisClientFactory = Redis.RedisClientFactory.Instance;

            this.PoolSizeMultiplier = poolSizeMultiplier ?? 10;

            this.Config = config ?? new RedisClientManagerConfig
            {
                MaxWritePoolSize = ReadWriteHosts.Count * PoolSizeMultiplier,
                MaxReadPoolSize  = ReadOnlyHosts.Count * PoolSizeMultiplier,
            };

            this.OnFailover = new List <Action <IRedisClientsManager> >();

            // if timeout provided, convert into milliseconds
            this.PoolTimeout = poolTimeOutSeconds != null
                ? poolTimeOutSeconds * 1000
                : 2000; //Default Timeout


            if (this.Config.AutoStart)
            {
                this.OnStart();
            }
        }
		public PooledRedisClientManager(
			IEnumerable<string> readWriteHosts,
			IEnumerable<string> readOnlyHosts,
			RedisClientManagerConfig config,
			int initalDb)
		{
			this.Db = config != null
				? config.DefaultDb.GetValueOrDefault(initalDb)
				: initalDb;

			ReadWriteHosts = readWriteHosts.ToIpEndPoints();
			ReadOnlyHosts = readOnlyHosts.ToIpEndPoints();

			this.RedisClientFactory = Redis.RedisClientFactory.Instance;

			this.Config = config ?? new RedisClientManagerConfig {
				MaxWritePoolSize = ReadWriteHosts.Count * PoolSizeMultiplier,
				MaxReadPoolSize = ReadOnlyHosts.Count * PoolSizeMultiplier,
			};

			if (this.Config.AutoStart)
			{
				this.OnStart();
			}
		}
        public PooledRedisClientManager(
            IEnumerable<string> readWriteHosts,
            IEnumerable<string> readOnlyHosts,
            RedisClientManagerConfig config,
            long initalDb,
            int? poolSizeMultiplier,
            int? poolTimeOutSeconds)
        {
            this.Db = config != null
                ? config.DefaultDb.GetValueOrDefault(initalDb)
                : initalDb;

            ReadWriteHosts = readWriteHosts.ToRedisEndPoints();
            ReadOnlyHosts = readOnlyHosts.ToRedisEndPoints();

            this.RedisClientFactory = Redis.RedisClientFactory.Instance;

            this.PoolSizeMultiplier = poolSizeMultiplier ?? 10;

            this.Config = config ?? new RedisClientManagerConfig
            {
                MaxWritePoolSize = ReadWriteHosts.Count * PoolSizeMultiplier,
                MaxReadPoolSize = ReadOnlyHosts.Count * PoolSizeMultiplier,
            };

            this.OnFailover = new List<Action<IRedisClientsManager>>();

            // if timeout provided, convert into milliseconds
            this.PoolTimeout = poolTimeOutSeconds != null
                ? poolTimeOutSeconds * 1000
                : 2000; //Default Timeout


            if (this.Config.AutoStart)
            {
                this.OnStart();
            }
        }