Skip to content

Commit 60d7c8a

Browse files
authored
Merge pull request #54 from cnblogs/tweak-MemcachedClientConfiguration
Set configuration to be optional in MemcachedClientConfiguration constructor
2 parents fc54677 + ab5419a commit 60d7c8a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Enyim.Caching/Configuration/MemcachedClientConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class MemcachedClientConfiguration : IMemcachedClientConfiguration
2727
public MemcachedClientConfiguration(
2828
ILoggerFactory loggerFactory,
2929
IOptions<MemcachedClientOptions> optionsAccessor,
30-
IConfiguration configuration,
30+
IConfiguration configuration = null,
3131
ITranscoder transcoder = null,
3232
IMemcachedKeyTransformer keyTransformer = null)
3333
{
@@ -39,7 +39,7 @@ public MemcachedClientConfiguration(
3939
_logger = loggerFactory.CreateLogger<MemcachedClientConfiguration>();
4040

4141
var options = optionsAccessor.Value;
42-
if(options == null || options.Servers.Count == 0)
42+
if ((options == null || options.Servers.Count == 0) && configuration != null)
4343
{
4444
configuration.GetSection("enyimMemcached").Bind(options);
4545
}

Enyim.Caching/Enyim.Caching.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<Description>EnyimMemcachedCore is a Memcached client library for .NET Core. Usage: Add services.AddEnyimMemcached(...) and app.UseEnyimMemcached() in Startup. Add IMemcachedClient into constructor.</Description>
5-
<VersionPrefix>2.1.3</VersionPrefix>
5+
<VersionPrefix>2.1.4</VersionPrefix>
66
<Authors>cnblogs.com</Authors>
77
<TargetFramework>netstandard2.0</TargetFramework>
88
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

0 commit comments

Comments
 (0)