Esempio n. 1
0
        private void ConfigureRedis(IStoveRedisCacheConfiguration redisConfiguration)
        {
            redisConfiguration.Configuration = RedisCachingSectionHandler.GetConfig();

            if (redisConfiguration.Configuration == null)
            {
                throw new StoveException("There is no Redis connection string section in app.config or web.config file, " +
                                         "please define redisCacheClient section and configurations. " +
                                         "If it is, please make sure of your config file is setted as CopyAlways from it's properties.");
            }

            redisConfiguration.ConfigurationOptions = new ConfigurationOptions
            {
                AllowAdmin         = redisConfiguration.Configuration.AllowAdmin,
                Ssl                = redisConfiguration.Configuration.Ssl,
                ConnectTimeout     = redisConfiguration.Configuration.ConnectTimeout,
                AbortOnConnectFail = false
            };

            foreach (RedisHost redisHost in redisConfiguration.Configuration.RedisHosts)
            {
                redisConfiguration.ConfigurationOptions.EndPoints.Add(redisHost.Host, redisHost.CachePort);
            }
        }
Esempio n. 2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="StoveRedisCacheClientProvider" /> class.
 /// </summary>
 public StoveRedisCacheClientProvider([NotNull] IStoveRedisCacheConfiguration configuration, [NotNull] RedisSerializer redisSerializer)
 {
     _configuration         = configuration;
     _redisSerializer       = redisSerializer;
     _connectionMultiplexer = new Lazy <ConnectionMultiplexer>(CreateConnectionMultiplexer);
 }
Esempio n. 3
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="StoveRedisCacheDatabaseProvider" /> class.
 /// </summary>
 public StoveRedisCacheDatabaseProvider([NotNull] IStoveRedisCacheConfiguration configuration)
 {
     _configuration         = configuration;
     _connectionMultiplexer = new Lazy <ConnectionMultiplexer>(CreateConnectionMultiplexer);
 }