/// <summary> /// Initializes a new instance of the <see cref="T:MemcachedClient"/> using the specified configuration instance. /// </summary> /// <param name="configuration">The memcachedClient configuration.</param> public static MemcachedClient CreateClient(IMemcachedClientConfiguration configuration) { if (configuration == null) throw new ArgumentNullException("configuration"); sockIOPool = configuration.CreatePool(); servers = configuration.Servers.Select(ip => ip.Address.ToString() + ":" + ip.Port).ToArray(); memcachedClient = new MemcachedClient(); memcachedClient.PoolName = sockIOPool.Name; memcachedClient.EnableCompression = false; return memcachedClient; }
/// <summary> /// Initializes a new instance of the <see cref="T:MemcachedClient"/> using the specified configuration instance. /// </summary> /// <param name="configuration">The memcachedClient configuration.</param> public MemcachedClient(IMemcachedClientConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException("configuration"); } this.keyTransformer = configuration.CreateKeyTransformer() ?? new DefaultKeyTransformer(); this.transcoder = configuration.CreateTranscoder() ?? new DefaultTranscoder(); this.performanceMonitor = configuration.CreatePerformanceMonitor(); this.pool = configuration.CreatePool(); this.pool.Start(); }
/// <summary> /// Initializes a new instance of the <see cref="T:MemcachedClient"/> using the specified configuration instance. /// </summary> /// <param name="configuration">The memcachedClient configuration.</param> public static MemcachedClient CreateClient(IMemcachedClientConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException("configuration"); } sockIOPool = configuration.CreatePool(); servers = configuration.Servers.Select(ip => ip.Address.ToString() + ":" + ip.Port).ToArray(); memcachedClient = new MemcachedClient(); memcachedClient.PoolName = sockIOPool.Name; memcachedClient.EnableCompression = false; return(memcachedClient); }
/// <summary> /// Initializes a new instance of the <see cref="T:MemcachedClient"/> using the specified configuration instance. /// </summary> /// <param name="configuration">The client configuration.</param> public MemcachedClient(IMemcachedClientConfiguration configuration) { if (configuration == null) throw new ArgumentNullException("configuration"); this.keyTransformer = configuration.CreateKeyTransformer() ?? new DefaultKeyTransformer(); this.transcoder = configuration.CreateTranscoder() ?? new DefaultTranscoder(); this.performanceMonitor = configuration.CreatePerformanceMonitor(); this.pool = configuration.CreatePool(); this.pool.NodeFailed += (n) => { var f = this.NodeFailed; if (f != null) f(n); }; this.StartPool(); StoreOperationResultFactory = new DefaultStoreOperationResultFactory(); GetOperationResultFactory = new DefaultGetOperationResultFactory(); MutateOperationResultFactory = new DefaultMutateOperationResultFactory(); ConcatOperationResultFactory = new DefaultConcatOperationResultFactory(); RemoveOperationResultFactory = new DefaultRemoveOperationResultFactory(); }