0

我目前正在使用 MS Enterprise Library 6 瞬态故障处理应用程序块。我提供了一个无效RedisCacheKey的来模拟服务中断。

瞬态故障处理

var retryStrategy = new FixedInterval(3, TimeSpan.FromSeconds(1));
var retryPolicy = new RetryPolicy<AzureRedisTransientErrorDetectionStrategy>(retryStrategy);
IDatabase cache;
try
{
    cache = retryPolicy.ExecuteAction(() => Redis.GetDatabase()); 
                                          //Redis is a ConnectionMultiplexer
     ...
} catch { ... }

观察调试输出

A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.ObjectDisposedException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.ObjectDisposedException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
The thread 0x107c has exited with code 259 (0x103).
A first chance exception of type 'StackExchange.Redis.RedisConnectionException' occurred in StackExchange.Redis.dll
The thread 0x115c has exited with code 259 (0x103).
A first chance exception of type 'StackExchange.Redis.RedisConnectionException' occurred in Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.dll
The thread 0xc04 has exited with code 259 (0x103).
The thread 0x10b8 has exited with code 259 (0x103).
The thread 0x1328 has exited with code 259 (0x103).
The thread 0x1244 has exited with code 259 (0x103).
The thread 0x748 has exited with code 259 (0x103).
The thread 0x14c0 has exited with code 259 (0x103).
The thread 0x1260 has exited with code 259 (0x103).
The thread 0x998 has exited with code 259 (0x103).
The thread 0x10b8 has exited with code 259 (0x103).
The thread 0x145c has exited with code 259 (0x103).
The thread 0x175c has exited with code 259 (0x103).
The thread 0x9a0 has exited with code 259 (0x103).

StackExchange.Redis 是否会破坏 azure redis 缓存?有没有人实现过类似的东西?

4

0 回答 0