Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisClient"/> class.
        /// </summary>
        /// <param name="endpoints">The Redis endpoints. The selected endpoint is selected in a rota basis.</param>
        /// <param name="options"><see cref="RedisClientOptions"/></param>
        public RedisClient(IPEndPoint[] endpoints, RedisClientOptions options = null)
            : this(options)
        {
            ParameterGuard.CannotBeNullOrEmpty(endpoints, "endpoints");

            _endpoints = endpoints.ToArray();

            _procedures = _options.Procedures != null?_options.Procedures.ToCollection() : ProcedureCollection.Empty;

            _proceduresInitializer = new ProcedureInitializer(_procedures, _options.Logger);

            _multiplexedCommander = new AggregatedCommandConnection <RedisCommanderConnection>(_options.MultiplexPool.CommandConnections, CommanderFactory, _options);
            _subscriptorsPool     = new ConnectionSelector <RedisSubscriberConnection>(_options.MultiplexPool.SubscriptionOptions, SubscriberFactory, _options);

            if (_options.ExclusivePool.Maximum > 0)
            {
                _exclusivePool = new ConnectionPool(_options.ExclusivePool.Minimum, _options.ExclusivePool.Maximum, CommanderFactory, _options.Logger);
            }
            else
            {
                _exclusivePool = DisabledConnectionPool.Instance;
            }

            IExecutionPlanner planner = new ExecutionPlanner(_procedures);
            _planner = _options.UseExecutionPlanCaching ? new CachingExecutionPlanner(planner) : planner;
        }
Esempio n. 2
0
 internal RedisChannel(IExecutionPlanner planner,
                       ProcedureCollection procedures,
                       ICommandConnection multiplexedCommander,
                       IConnectionProvider <ISubscriptionConnection> subscribers,
                       IConnectionProvider <ICommandConnection> exclusivePool)
 {
     _multiplexedCommander = multiplexedCommander;
     _exclusivePool        = exclusivePool;
     _subscribers          = subscribers;
     _planner    = planner;
     _procedures = procedures;
     _context    = new ExecutionContext();
 }
 internal CachingExecutionPlanner(IExecutionPlanner inner)
 {
     _inner = inner;
     _cache = new ConcurrentDictionary <String, ExecutionPlan>();
 }