Exemple #1
0
 public RedisDatabaseAdapter(RedisDatabaseFactory databaseFactory, RedisDatabaseAdapterConfiguration configuration, IClock?clock = null)
 {
     _configuration      = configuration;
     _redisRetryStrategy = configuration.CreateRetryPolicy(OnRedisException);
     _databaseFactory    = databaseFactory;
     _clock = clock ?? SystemClock.Instance;
 }
Exemple #2
0
        private RedisDatabaseAdapter CreateDatabase(RedisDatabaseFactory factory, string databaseName, bool optional = false)
        {
            if (factory != null)
            {
                var adapterConfiguration = new RedisDatabaseAdapterConfiguration(
                    KeySpace,
                    Configuration.RedisConnectionErrorLimit,
                    traceOperationFailures: Configuration.TraceRedisFailures,
                    traceTransientFailures: Configuration.TraceRedisTransientFailures,
                    databaseName: databaseName);

                return(new RedisDatabaseAdapter(factory, adapterConfiguration));
            }
            else
            {
                Contract.Assert(optional);
                return(null);
            }
        }
        private RedisDatabaseAdapter?CreateDatabase(RedisDatabaseFactory?factory, string databaseName, bool optional = false)
        {
            if (factory != null)
            {
                var adapterConfiguration = new RedisDatabaseAdapterConfiguration(
                    KeySpace,
                    Configuration.RedisConnectionErrorLimit,
                    Configuration.RedisReconnectionLimitBeforeServiceRestart,
                    traceOperationFailures: Configuration.TraceRedisFailures,
                    traceTransientFailures: Configuration.TraceRedisTransientFailures,
                    databaseName: databaseName,
                    minReconnectInterval: Configuration.MinRedisReconnectInterval,
                    cancelBatchWhenMultiplexerIsClosed: Configuration.CancelBatchWhenMultiplexerIsClosed);

                return(new RedisDatabaseAdapter(factory, adapterConfiguration));
            }
            else
            {
                Contract.Assert(optional);
                return(null);
            }
        }
        private RedisDatabaseAdapter?CreateDatabase(RedisDatabaseFactory?factory, string databaseName, bool optional = false)
        {
            if (factory != null)
            {
                var adapterConfiguration = new RedisDatabaseAdapterConfiguration(
                    KeySpace,
                    Configuration.RedisConnectionErrorLimit,
                    Configuration.RedisReconnectionLimitBeforeServiceRestart,
                    databaseName: databaseName,
                    minReconnectInterval: Configuration.MinRedisReconnectInterval,
                    cancelBatchWhenMultiplexerIsClosed: Configuration.CancelBatchWhenMultiplexerIsClosed,
                    treatObjectDisposedExceptionAsTransient: Configuration.TreatObjectDisposedExceptionAsTransient,
                    operationTimeout: Configuration.OperationTimeout,
                    exponentialBackoffConfiguration: Configuration.ExponentialBackoffConfiguration,
                    retryCount: Configuration.RetryCount);

                return(new RedisDatabaseAdapter(factory, adapterConfiguration));
            }
            else
            {
                Contract.Assert(optional);
                return(null);
            }
        }
Exemple #5
0
 public RedisDatabaseAdapter(RedisDatabaseFactory databaseFactory, RedisDatabaseAdapterConfiguration configuration)
 {
     _configuration      = configuration;
     _redisRetryStrategy = configuration.CreateRetryPolicy(OnRedisException);
     _databaseFactory    = databaseFactory;
 }