Skip to content

Commit 26b7bc4

Browse files
DOC-5192 added C# production usage page
1 parent d07e999 commit 26b7bc4

File tree

6 files changed

+77
-5
lines changed

6 files changed

+77
-5
lines changed

content/develop/clients/dotnet/condexec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ categories:
1212
description: Understand how `NRedisStack` uses conditional execution
1313
linkTitle: Conditional execution
1414
title: Conditional execution
15-
weight: 6
15+
weight: 60
1616
---
1717

1818
Most Redis client libraries use transactions with the

content/develop/clients/dotnet/connect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ categories:
1212
description: Connect your .NET application to a Redis database
1313
linkTitle: Connect
1414
title: Connect to the server
15-
weight: 2
15+
weight: 20
1616
---
1717

1818
## Basic connection
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
categories:
3+
- docs
4+
- develop
5+
- stack
6+
- oss
7+
- rs
8+
- rc
9+
- oss
10+
- kubernetes
11+
- clients
12+
description: Get your NRedisStack app ready for production
13+
linkTitle: Production usage
14+
title: Production usage
15+
weight: 70
16+
---
17+
18+
This guide offers recommendations to get the best reliability and
19+
performance in your production environment.
20+
21+
## Checklist
22+
23+
Each item in the checklist below links to the section
24+
for a recommendation. Use the checklist icons to record your
25+
progress in implementing the recommendations.
26+
27+
{{< checklist "prodlist" >}}
28+
{{< checklist-item "#server-maintenance-event-handling" >}}Server maintenance event handling{{< /checklist-item >}}
29+
{{< checklist-item "#exception-handling" >}}Exception handling{{< /checklist-item >}}
30+
{{< /checklist >}}
31+
32+
## Recommendations
33+
34+
The sections below offer recommendations for your production environment. Some
35+
of them may not apply to your particular use case.
36+
37+
### Server maintenance event handling
38+
39+
Some servers (such as Azure Cache for Redis) send notification events shortly
40+
before scheduled maintenance is due to happen. You can use code like the
41+
following to respond to these events (see the
42+
[StackExchange.Redis](https://stackexchange.github.io/StackExchange.Redis/ServerMaintenanceEvent)
43+
docs for the full list of supported events). For example, you could
44+
inform users who try to connect that service is temporarily unavailable
45+
rather than letting them run into errors.
46+
47+
```cs
48+
using NRedisStack;
49+
using StackExchange.Redis;
50+
51+
ConnectionMultiplexer muxer = ConnectionMultiplexer.Connect("localhost:6379");
52+
53+
muxer.ServerMaintenanceEvent += (object sender, ServerMaintenanceEvent e) => {
54+
// Identify the event and respond to it here.
55+
Console.WriteLine($"Maintenance event: {e.RawMessage}");
56+
};
57+
```
58+
59+
### Exception handling
60+
61+
Redis handles many errors using return values from commands, but there
62+
are also situations where exceptions can be thrown. In production code,
63+
you should handle exceptions as they occur. The list below describes some
64+
the most common Redis exceptions:
65+
66+
- `RedisConnectionException`: Thrown when a connection attempt fails.
67+
- `RedisTimeoutException`: Thrown when a command times out.
68+
- `RedisCommandException`: Thrown when you issue an invalid command.
69+
- `RedisServerException`: Thrown when you attempt an invalid operation
70+
(for example, trying to access a
71+
[stream entry]({{< relref "/develop/data-types/streams#entry-ids" >}})
72+
using an invalid ID).

content/develop/clients/dotnet/queryjson.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ categories:
1212
description: Learn how to use the Redis query engine with JSON and hash documents.
1313
linkTitle: Index and query documents
1414
title: Index and query documents
15-
weight: 2
15+
weight: 30
1616
---
1717

1818
This example shows how to create a

content/develop/clients/dotnet/transpipe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ categories:
1212
description: Learn how to use Redis pipelines and transactions
1313
linkTitle: Pipelines/transactions
1414
title: Pipelines and transactions
15-
weight: 5
15+
weight: 50
1616
---
1717

1818
Redis lets you send a sequence of commands to the server together in a batch.

content/develop/clients/dotnet/vecsearch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ categories:
1212
description: Learn how to index and query vector embeddings with Redis
1313
linkTitle: Index and query vectors
1414
title: Index and query vectors
15-
weight: 3
15+
weight: 40
1616
---
1717

1818
[Redis Query Engine]({{< relref "/develop/interact/search-and-query" >}})

0 commit comments

Comments
 (0)