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
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public MemcachedClientConfiguration(
SocketPool = new SocketPoolConfiguration();
if (options.SocketPool != null)
{
options.SocketPool.CheckPoolSize();
options.SocketPool.CheckTimeout();

SocketPool.MinPoolSize = options.SocketPool.MinPoolSize;
Expand Down
12 changes: 12 additions & 0 deletions Enyim.Caching/Configuration/MemcachedClientOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ public class SocketPoolOptions
public TimeSpan DeadTimeout { get; set; } = new TimeSpan(0, 0, 10);
public TimeSpan QueueTimeout { get; set; } = new TimeSpan(0, 0, 0, 0, 100);

public void CheckPoolSize()
{
if (MinPoolSize < 0)
throw new ArgumentOutOfRangeException("value", "MinPoolSize must be >= 0!");

if (MinPoolSize > MaxPoolSize)
throw new ArgumentOutOfRangeException("value", "MinPoolSize must be <= MaxPoolSize!");

if (MaxPoolSize < MinPoolSize)
throw new ArgumentOutOfRangeException("value", "MaxPoolSize must be >= MinPoolSize!");
}

public void CheckTimeout()
{
CheckTimeout(nameof(ConnectionTimeout), ConnectionTimeout);
Expand Down
19 changes: 2 additions & 17 deletions Enyim.Caching/Configuration/SocketPoolConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,7 @@ public class SocketPoolConfiguration : ISocketPoolConfiguration
int ISocketPoolConfiguration.MinPoolSize
{
get { return this.minPoolSize; }
set
{
if (value < 0)
throw new ArgumentOutOfRangeException("value", "MinPoolSize must be >= 0!");

if (value > this.maxPoolSize)
throw new ArgumentOutOfRangeException("value", "MinPoolSize must be <= MaxPoolSize!");

this.minPoolSize = value;
}
set { this.minPoolSize = value; }
}

/// <summary>
Expand All @@ -39,13 +30,7 @@ int ISocketPoolConfiguration.MinPoolSize
int ISocketPoolConfiguration.MaxPoolSize
{
get { return this.maxPoolSize; }
set
{
if (value < this.minPoolSize)
throw new ArgumentOutOfRangeException("value", "MaxPoolSize must be >= MinPoolSize!");

this.maxPoolSize = value;
}
set { this.maxPoolSize = value; }
}

TimeSpan ISocketPoolConfiguration.ConnectionTimeout
Expand Down
2 changes: 1 addition & 1 deletion Enyim.Caching/Enyim.Caching.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>EnyimMemcachedCore is a Memcached client library for .NET Core. Usage: Add services.AddEnyimMemcached(...) and app.UseEnyimMemcached() in Startup. Add IMemcachedClient into constructor.</Description>
<VersionPrefix>2.1.0.1</VersionPrefix>
<VersionPrefix>2.1.0.2</VersionPrefix>
<Authors>cnblogs.com</Authors>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down