public Distributed(DistributedOptions options, IHashAlgorithmProvider hashAlgorithmProvider) { Options = options; Pool = new SynchronizedKetamaPool <IClient>("Distributed", hashAlgorithmProvider, options.ClientAccessTimeout); Idle = new SynchronizedPool <IClient>(m_sync, new IdleTimeoutPool <IClient>(m_sync, new StackPool <IClient>("Distributed Idle", options.IdlePoolSize), RetryIdled, options.IdleLeaseTime, options.IdleLeaseTime), options.IdleAccessTimeout); }
public DefaultClientFactory(ConnectionOptions[] connectionOptions, DistributedOptions distributedOptions, IHashAlgorithmProvider hashAlgorithmProvider) { if (connectionOptions.Length > 1) { var distributed = new Distributed(distributedOptions, hashAlgorithmProvider); var clients = new IClient[connectionOptions.Length]; for (int i = 0; i < connectionOptions.Length; i++) { clients[i] = CreateClient(connectionOptions[i]); } distributed.AddRange(clients); m_slaves = clients; m_master = distributed; } else { m_master = CreateClient(connectionOptions[0]); } }