Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Enyim.Caching/Configuration/AuthenticationConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ namespace Enyim.Caching.Configuration
{
public class AuthenticationConfiguration : IAuthenticationConfiguration
{
private Type authenticator;
private Dictionary<string, object> parameters;
private Type _authenticator;
private Dictionary<string, object> _parameters;

Type IAuthenticationConfiguration.Type
{
get { return this.authenticator; }
get { return _authenticator; }
set
{
ConfigurationHelper.CheckForInterface(value, typeof(ISaslAuthenticationProvider));
this.authenticator = value;
_authenticator = value;
}
}

Dictionary<string, object> IAuthenticationConfiguration.Parameters
{
get { return this.parameters ?? (this.parameters = new Dictionary<string, object>()); }
get { return _parameters ?? (_parameters = new Dictionary<string, object>()); }
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/Enyim.Caching/Configuration/JsonVBucketConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
// /// </summary>
// public class JsonVBucketConfig : IVBucketConfiguration
// {
// private Func<HashAlgorithm> factory;
// private IPEndPoint[] servers;
// private VBucket[] buckets;
// private Func<HashAlgorithm> _factory;
// private IPEndPoint[] _servers;
// private VBucket[] _buckets;

// public JsonVBucketConfig(string json)
// {
Expand All @@ -25,11 +25,11 @@
// if (config.numReplicas < 0)
// throw new ArgumentException("Invalid numReplicas: " + config.numReplicas, "json");

// if (hashFactory.TryGetValue(config.hashAlgorithm, out this.factory))
// if (hashFactory.TryGetValue(config.hashAlgorithm, out _factory))
// throw new ArgumentException("Unknown hash algorithm: " + config.hashAlgorithm, "json");

// this.servers = config.serverList.Select(endpoint => ConfigurationHelper.ResolveToEndPoint(endpoint)).ToArray();
// this.buckets = config.vBucketMap.Select((bucket, index) =>
// _servers = config.serverList.Select(endpoint => ConfigurationHelper.ResolveToEndPoint(endpoint)).ToArray();
// _buckets = config.vBucketMap.Select((bucket, index) =>
// {
// if (bucket == null || bucket.Length != config.numReplicas + 1)
// throw new ArgumentException("Invalid bucket definition at index " + index, "json");
Expand Down Expand Up @@ -58,12 +58,12 @@

// IList<IPEndPoint> IVBucketConfiguration.Servers
// {
// get { return this.servers; }
// get { return _servers; }
// }

// IList<VBucket> IVBucketConfiguration.Buckets
// {
// get { return this.buckets; }
// get { return _buckets; }
// }

// #endregion
Expand Down
38 changes: 19 additions & 19 deletions src/Enyim.Caching/Configuration/MemcachedClientConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Enyim.Caching.Configuration
public class MemcachedClientConfiguration : IMemcachedClientConfiguration
{
// these are lazy initialized in the getters
private Type nodeLocator;
private Type _nodeLocator;
private ITranscoder _transcoder;
private IMemcachedKeyTransformer _keyTransformer;
private ILogger<MemcachedClientConfiguration> _logger;
Expand Down Expand Up @@ -137,7 +137,7 @@ public MemcachedClientConfiguration(
}
else if (keyTransformer != null)
{
this._keyTransformer = keyTransformer;
_keyTransformer = keyTransformer;
_logger.LogDebug($"Use KeyTransformer Type : '{keyTransformer.ToString()}'");
}

Expand Down Expand Up @@ -167,7 +167,7 @@ public MemcachedClientConfiguration(
}
else if (transcoder != null)
{
this._transcoder = transcoder;
_transcoder = transcoder;
_logger.LogDebug($"Use Transcoder Type : '{transcoder.ToString()}'");
}

Expand Down Expand Up @@ -218,7 +218,7 @@ private void ConfigureServers(MemcachedClientOptions options)
/// <param name="address">The address and the port of the server in the format 'host:port'.</param>
public void AddServer(string address)
{
this.Servers.Add(ConfigurationHelper.ResolveToEndPoint(address));
Servers.Add(ConfigurationHelper.ResolveToEndPoint(address));
}

/// <summary>
Expand All @@ -228,7 +228,7 @@ public void AddServer(string address)
/// <param name="port">The port number of the memcached instance.</param>
public void AddServer(string host, int port)
{
this.Servers.Add(new DnsEndPoint(host, port));
Servers.Add(new DnsEndPoint(host, port));
}

/// <summary>
Expand All @@ -251,8 +251,8 @@ public void AddServer(string host, int port)
/// </summary>
public IMemcachedKeyTransformer KeyTransformer
{
get { return this._keyTransformer ?? (this._keyTransformer = new DefaultKeyTransformer()); }
set { this._keyTransformer = value; }
get { return _keyTransformer ?? (_keyTransformer = new DefaultKeyTransformer()); }
set { _keyTransformer = value; }
}

/// <summary>
Expand All @@ -261,11 +261,11 @@ public IMemcachedKeyTransformer KeyTransformer
/// <remarks>If both <see cref="M:NodeLocator"/> and <see cref="M:NodeLocatorFactory"/> are assigned then the latter takes precedence.</remarks>
public Type NodeLocator
{
get { return this.nodeLocator; }
get { return _nodeLocator; }
set
{
ConfigurationHelper.CheckForInterface(value, typeof(IMemcachedNodeLocator));
this.nodeLocator = value;
_nodeLocator = value;
}
}

Expand Down Expand Up @@ -293,48 +293,48 @@ public ITranscoder Transcoder

IList<EndPoint> IMemcachedClientConfiguration.Servers
{
get { return this.Servers; }
get { return Servers; }
}

ISocketPoolConfiguration IMemcachedClientConfiguration.SocketPool
{
get { return this.SocketPool; }
get { return SocketPool; }
}

IAuthenticationConfiguration IMemcachedClientConfiguration.Authentication
{
get { return this.Authentication; }
get { return Authentication; }
}

IMemcachedKeyTransformer IMemcachedClientConfiguration.CreateKeyTransformer()
{
return this.KeyTransformer;
return KeyTransformer;
}

IMemcachedNodeLocator IMemcachedClientConfiguration.CreateNodeLocator()
{
var f = this.NodeLocatorFactory;
var f = NodeLocatorFactory;
if (f != null) return f.Create();

return this.NodeLocator == null
return NodeLocator == null
? new SingleNodeLocator()
: (IMemcachedNodeLocator)FastActivator.Create(this.NodeLocator);
: (IMemcachedNodeLocator)FastActivator.Create(NodeLocator);
}

ITranscoder IMemcachedClientConfiguration.CreateTranscoder()
{
return this.Transcoder;
return Transcoder;
}

IServerPool IMemcachedClientConfiguration.CreatePool()
{
switch (this.Protocol)
switch (Protocol)
{
case MemcachedProtocol.Text: return new DefaultServerPool(this, new Memcached.Protocol.Text.TextOperationFactory(), _logger);
case MemcachedProtocol.Binary: return new BinaryPool(this, _logger);
}

throw new ArgumentOutOfRangeException("Unknown protocol: " + (int)this.Protocol);
throw new ArgumentOutOfRangeException("Unknown protocol: " + (int)Protocol);
}

public bool UseSslStream { get; private set; }
Expand Down
44 changes: 22 additions & 22 deletions src/Enyim.Caching/Configuration/SocketPoolConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ namespace Enyim.Caching.Configuration
{
public class SocketPoolConfiguration : ISocketPoolConfiguration
{
private int minPoolSize = 5;
private int maxPoolSize = 100;
private bool useSslStream = false;
private TimeSpan connectionTimeout = new TimeSpan(0, 0, 10);
private TimeSpan receiveTimeout = new TimeSpan(0, 0, 10);
private TimeSpan deadTimeout = new TimeSpan(0, 0, 10);
private TimeSpan queueTimeout = new TimeSpan(0, 0, 0, 0, 100);
private int _minPoolSize = 5;
private int _maxPoolSize = 100;
private bool _useSslStream = false;
private TimeSpan _connectionTimeout = new TimeSpan(0, 0, 10);
private TimeSpan _receiveTimeout = new TimeSpan(0, 0, 10);
private TimeSpan _deadTimeout = new TimeSpan(0, 0, 10);
private TimeSpan _queueTimeout = new TimeSpan(0, 0, 0, 0, 100);
private TimeSpan _initPoolTimeout = new TimeSpan(0, 1, 0);
private INodeFailurePolicyFactory FailurePolicyFactory = new ThrottlingFailurePolicyFactory(5, TimeSpan.FromMilliseconds(2000));
private INodeFailurePolicyFactory _failurePolicyFactory = new ThrottlingFailurePolicyFactory(5, TimeSpan.FromMilliseconds(2000));

int ISocketPoolConfiguration.MinPoolSize
{
get { return this.minPoolSize; }
set { this.minPoolSize = value; }
get { return _minPoolSize; }
set { _minPoolSize = value; }
}

/// <summary>
Expand All @@ -31,43 +31,43 @@ int ISocketPoolConfiguration.MinPoolSize
/// <remarks>It should be 0.75 * (number of threads) for optimal performance.</remarks>
int ISocketPoolConfiguration.MaxPoolSize
{
get { return this.maxPoolSize; }
set { this.maxPoolSize = value; }
get { return _maxPoolSize; }
set { _maxPoolSize = value; }
}

TimeSpan ISocketPoolConfiguration.ConnectionTimeout
{
get { return this.connectionTimeout; }
get { return _connectionTimeout; }
set
{
if (value < TimeSpan.Zero)
throw new ArgumentOutOfRangeException("value", "value must be positive");

this.connectionTimeout = value;
_connectionTimeout = value;
}
}

TimeSpan ISocketPoolConfiguration.ReceiveTimeout
{
get { return this.receiveTimeout; }
get { return _receiveTimeout; }
set
{
if (value < TimeSpan.Zero)
throw new ArgumentOutOfRangeException("value", "value must be positive");

this.receiveTimeout = value;
_receiveTimeout = value;
}
}

TimeSpan ISocketPoolConfiguration.QueueTimeout
{
get { return this.queueTimeout; }
get { return _queueTimeout; }
set
{
if (value < TimeSpan.Zero)
throw new ArgumentOutOfRangeException("value", "value must be positive");

this.queueTimeout = value;
_queueTimeout = value;
}
}

Expand All @@ -85,25 +85,25 @@ TimeSpan ISocketPoolConfiguration.InitPoolTimeout

TimeSpan ISocketPoolConfiguration.DeadTimeout
{
get { return this.deadTimeout; }
get { return _deadTimeout; }
set
{
if (value < TimeSpan.Zero)
throw new ArgumentOutOfRangeException("value", "value must be positive");

this.deadTimeout = value;
_deadTimeout = value;
}
}

INodeFailurePolicyFactory ISocketPoolConfiguration.FailurePolicyFactory
{
get { return this.FailurePolicyFactory; }
get { return _failurePolicyFactory; }
set
{
if (value == null)
throw new ArgumentNullException("value");

this.FailurePolicyFactory = value;
_failurePolicyFactory = value;
}
}
}
Expand Down
Loading