@@ -48,7 +48,8 @@ var db = muxer.GetDatabase();
4848try {
4949 var result = db .StringGet (" key" );
5050} catch (RedisCommandException ) {
51- // This indicates a bug in our code
51+ // This indicates a bug in the code, such as using
52+ // StringGet on a list key.
5253 throw ;
5354}
5455```
@@ -62,21 +63,18 @@ for a full description):
6263``` csharp
6364try {
6465 var cachedValue = db .StringGet (key );
65- if (cachedValue .HasValue ) {
66- return cachedValue .ToString ();
67- }
66+ return cachedValue .ToString ();
6867} catch (RedisConnectionException ) {
6968 logger .LogWarning (" Cache unavailable, using database" );
69+
70+ // Fallback to database
7071 return database .Get (key );
7172}
72-
73- // Fallback to database
74- return database .Get (key );
7573```
7674
7775### Pattern 3: Retry with backoff
7876
79- Retry on temporary errors like timeouts (see
77+ Retry on temporary errors such as timeouts (see
8078[ Pattern 3: Retry with backoff] ({{< relref "/develop/clients/error-handling#pattern-3-retry-with-backoff" >}})
8179for a full description):
8280
@@ -98,6 +96,9 @@ for (int attempt = 0; attempt < maxRetries; attempt++) {
9896}
9997```
10098
99+ See also [ Timeouts] ({{< relref "/develop/clients/dotnet/produsage#timeouts" >}})
100+ for more information on configuring timeouts in NRedisStack.
101+
101102### Pattern 4: Log and continue
102103
103104Log non-critical errors and continue (see
@@ -115,7 +116,8 @@ try {
115116
116117## Async error handling
117118
118- If you're using async methods, error handling works the same way with ` async ` /` await ` :
119+ Error handling works the usual way with ` async ` /` await ` , as shown in the
120+ example below:
119121
120122``` csharp
121123using NRedisStack ;
@@ -143,5 +145,3 @@ async Task<string> GetWithFallbackAsync(string key) {
143145
144146- [ Error handling] ({{< relref "/develop/clients/error-handling" >}})
145147- [ Production usage] ({{< relref "/develop/clients/dotnet/produsage" >}})
146- - [ Connection pooling] ({{< relref "/develop/clients/pools-and-muxing" >}})
147-
0 commit comments