@@ -43,6 +43,7 @@ public MemcachedClientConfiguration(
43
43
_logger = loggerFactory . CreateLogger < MemcachedClientConfiguration > ( ) ;
44
44
45
45
var options = optionsAccessor . Value ;
46
+ #if NET5_0_OR_GREATER
46
47
if ( ( options == null || options . Servers . Count == 0 ) && configuration != null )
47
48
{
48
49
var section = configuration . GetSection ( "enyimMemcached" ) ;
@@ -56,6 +57,7 @@ public MemcachedClientConfiguration(
56
57
options . AddDefaultServer ( ) ;
57
58
}
58
59
}
60
+ #endif
59
61
60
62
ConfigureServers ( options ) ;
61
63
@@ -84,7 +86,8 @@ public MemcachedClientConfiguration(
84
86
_logger . LogInformation ( $ "{ nameof ( SocketPool . QueueTimeout ) } : { SocketPool . QueueTimeout } ") ;
85
87
86
88
SocketPool . ConnectionIdleTimeout = options . SocketPool . ConnectionIdleTimeout ;
87
- _logger . LogInformation ( $ "{ nameof ( SocketPool . ConnectionIdleTimeout ) } : { SocketPool . ConnectionIdleTimeout } ") ;
89
+ _logger . LogInformation (
90
+ $ "{ nameof ( SocketPool . ConnectionIdleTimeout ) } : { SocketPool . ConnectionIdleTimeout } ") ;
88
91
89
92
SocketPool . InitPoolTimeout = options . SocketPool . InitPoolTimeout ;
90
93
@@ -117,14 +120,17 @@ public MemcachedClientConfiguration(
117
120
}
118
121
catch ( Exception ex )
119
122
{
120
- _logger . LogError ( new EventId ( ) , ex , $ "Unable to load authentication type { options . Authentication . Type } .") ;
123
+ _logger . LogError ( new EventId ( ) , ex ,
124
+ $ "Unable to load authentication type { options . Authentication . Type } .") ;
121
125
}
122
126
}
123
127
124
128
UseSslStream = options . UseSslStream ;
125
129
UseIPv6 = options . UseIPv6 ;
126
130
SuppressException = options . SuppressException ;
131
+ #if NET5_0_OR_GREATER
127
132
SslClientAuth = options . SslClientAuth ;
133
+ #endif
128
134
129
135
if ( ! string . IsNullOrEmpty ( options . KeyTransformer ) )
130
136
{
@@ -213,7 +219,10 @@ private void ConfigureServers(MemcachedClientOptions options)
213
219
if ( ! IPAddress . TryParse ( server . Address , out var address ) )
214
220
{
215
221
address = Dns . GetHostAddresses ( server . Address )
216
- . FirstOrDefault ( i => i . AddressFamily == ( options . UseIPv6 ? AddressFamily . InterNetworkV6 : AddressFamily . InterNetwork ) ) ;
222
+ . FirstOrDefault ( i =>
223
+ i . AddressFamily == ( options . UseIPv6
224
+ ? AddressFamily . InterNetworkV6
225
+ : AddressFamily . InterNetwork ) ) ;
217
226
218
227
if ( address == null )
219
228
{
@@ -339,8 +348,8 @@ IMemcachedNodeLocator IMemcachedClientConfiguration.CreateNodeLocator()
339
348
if ( f != null ) return f . Create ( ) ;
340
349
341
350
return NodeLocator == null
342
- ? new SingleNodeLocator ( )
343
- : ( IMemcachedNodeLocator ) FastActivator . Create ( NodeLocator ) ;
351
+ ? new SingleNodeLocator ( )
352
+ : ( IMemcachedNodeLocator ) FastActivator . Create ( NodeLocator ) ;
344
353
}
345
354
346
355
ITranscoder IMemcachedClientConfiguration . CreateTranscoder ( )
@@ -352,7 +361,8 @@ IServerPool IMemcachedClientConfiguration.CreatePool()
352
361
{
353
362
switch ( Protocol )
354
363
{
355
- case MemcachedProtocol . Text : return new DefaultServerPool ( this , new Memcached . Protocol . Text . TextOperationFactory ( ) , _logger ) ;
364
+ case MemcachedProtocol . Text :
365
+ return new DefaultServerPool ( this , new Memcached . Protocol . Text . TextOperationFactory ( ) , _logger ) ;
356
366
case MemcachedProtocol . Binary : return new BinaryPool ( this , _logger ) ;
357
367
}
358
368
@@ -362,28 +372,32 @@ IServerPool IMemcachedClientConfiguration.CreatePool()
362
372
public bool UseSslStream { get ; private set ; }
363
373
public bool UseIPv6 { get ; private set ; }
364
374
public bool SuppressException { get ; private set ; }
375
+ #if NET5_0_OR_GREATER
365
376
public SslClientAuthenticationOptions SslClientAuth { get ; private set ; }
377
+ #endif
366
378
367
379
#endregion
368
380
}
369
381
}
370
382
371
383
#region [ License information ]
384
+
372
385
/* ************************************************************
373
- *
386
+ *
374
387
* Copyright (c) 2010 Attila Kisk? enyim.com
375
- *
388
+ *
376
389
* Licensed under the Apache License, Version 2.0 (the "License");
377
390
* you may not use this file except in compliance with the License.
378
391
* You may obtain a copy of the License at
379
- *
392
+ *
380
393
* http://www.apache.org/licenses/LICENSE-2.0
381
- *
394
+ *
382
395
* Unless required by applicable law or agreed to in writing, software
383
396
* distributed under the License is distributed on an "AS IS" BASIS,
384
397
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
385
398
* See the License for the specific language governing permissions and
386
399
* limitations under the License.
387
- *
400
+ *
388
401
* ************************************************************/
389
- #endregion
402
+
403
+ #endregion
0 commit comments