1
+ using Enyim . Caching . Configuration ;
2
+ using Enyim . Caching . Memcached . Protocol . Binary ;
3
+ using Enyim . Caching . Memcached . Results ;
4
+ using Enyim . Caching . Memcached . Results . Extensions ;
5
+ using Enyim . Collections ;
6
+ using Microsoft . Extensions . Logging ;
1
7
using System ;
2
8
using System . Collections . Generic ;
3
9
using System . Diagnostics ;
10
+ using System . IO ;
4
11
using System . Net ;
5
- using System . Threading ;
6
- using Enyim . Caching . Configuration ;
7
- using Enyim . Collections ;
8
- using System . Security ;
9
- using Enyim . Caching . Memcached . Protocol . Binary ;
10
12
using System . Runtime . Serialization ;
11
- using System . IO ;
12
- using Enyim . Caching . Memcached . Results ;
13
- using Enyim . Caching . Memcached . Results . Extensions ;
13
+ using System . Security ;
14
+ using System . Threading ;
14
15
using System . Threading . Tasks ;
15
- using Microsoft . Extensions . Logging ;
16
16
17
17
namespace Enyim . Caching . Memcached
18
18
{
@@ -27,13 +27,13 @@ public class MemcachedNode : IMemcachedNode
27
27
28
28
private bool isDisposed ;
29
29
30
- private DnsEndPoint endPoint ;
31
- private ISocketPoolConfiguration config ;
30
+ private readonly DnsEndPoint endPoint ;
31
+ private readonly ISocketPoolConfiguration config ;
32
32
private InternalPoolImpl internalPoolImpl ;
33
33
private bool isInitialized ;
34
34
35
35
public MemcachedNode (
36
- DnsEndPoint endpoint ,
36
+ DnsEndPoint endpoint ,
37
37
ISocketPoolConfiguration socketPoolConfig ,
38
38
ILogger logger )
39
39
{
@@ -186,7 +186,7 @@ void IDisposable.Dispose()
186
186
private class InternalPoolImpl : IDisposable
187
187
{
188
188
private readonly ILogger _logger ;
189
- private bool _isDebugEnabled ;
189
+ private readonly bool _isDebugEnabled ;
190
190
191
191
/// <summary>
192
192
/// A list of already connected but free to use sockets
@@ -197,18 +197,18 @@ private class InternalPoolImpl : IDisposable
197
197
private bool isAlive ;
198
198
private DateTime markedAsDeadUtc ;
199
199
200
- private int minItems ;
201
- private int maxItems ;
200
+ private readonly int minItems ;
201
+ private readonly int maxItems ;
202
202
203
203
private MemcachedNode ownerNode ;
204
- private EndPoint endPoint ;
205
- private TimeSpan queueTimeout ;
204
+ private readonly EndPoint endPoint ;
205
+ private readonly TimeSpan queueTimeout ;
206
206
private Semaphore semaphore ;
207
207
208
- private object initLock = new Object ( ) ;
208
+ private readonly object initLock = new Object ( ) ;
209
209
210
210
internal InternalPoolImpl (
211
- MemcachedNode ownerNode ,
211
+ MemcachedNode ownerNode ,
212
212
ISocketPoolConfiguration config ,
213
213
ILogger logger )
214
214
{
@@ -519,9 +519,9 @@ protected internal virtual PooledSocket CreateSocket()
519
519
{
520
520
return new PooledSocket ( this . endPoint , this . config . ConnectionTimeout , this . config . ReceiveTimeout , _logger ) ;
521
521
}
522
- catch ( Exception ex )
522
+ catch ( Exception ex )
523
523
{
524
- _logger . LogError ( new EventId ( this . GetHashCode ( ) , nameof ( MemcachedNode ) ) , ex , $ "Create { nameof ( PooledSocket ) } ") ;
524
+ _logger . LogError ( new EventId ( this . GetHashCode ( ) , nameof ( MemcachedNode ) ) , ex , $ "Create { nameof ( PooledSocket ) } ") ;
525
525
throw ;
526
526
}
527
527
}
@@ -582,12 +582,16 @@ protected virtual IPooledSocketResult ExecuteOperation(IOperation op)
582
582
583
583
protected async virtual Task < IPooledSocketResult > ExecuteOperationAsync ( IOperation op )
584
584
{
585
+ _logger . LogDebug ( $ "ExecuteOperationAsync({ op } )") ;
586
+
585
587
var result = this . Acquire ( ) ;
586
588
if ( result . Success && result . HasValue )
587
589
{
588
590
try
589
591
{
590
592
var pooledSocket = result . Value ;
593
+
594
+
591
595
//if Get, call BinaryRequest.CreateBuffer()
592
596
var b = op . GetBuffer ( ) ;
593
597
0 commit comments