/// <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; }
static List <RESPCommand> GenerateCommands(RedisClientOptions options) { var list = new List <RESPCommand>(); var planner = new ExecutionPlanner(); foreach (var cmd in options.InitializationCommands) { var plan = planner.Build(cmd.Command); var respCommand = plan.Bind(cmd.Parameters); list.AddRange(respCommand); } return(list); }