You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make a note of the values for **HOST NAME** and the **Primary** access key. You'll use these values later to construct the `CacheConnection` secret.
34
+
Make a note of the values for **HOST NAME** and the **Primary** access key. You ise these values later to construct the `CacheConnection` secret.
35
35
36
36
## Add a local secret for the connection string
37
37
38
-
In your command window, execute the following command to store a new secret named *CacheConnection* after you replac the placeholders (including angle brackets) with your cache name (`<cache name>`) and primary access key (`<primary-access-key>`):
38
+
In your command window, execute the following command to store a new secret named *CacheConnection* after you replace the placeholders (including angle brackets) with your cache name (`<cache name>`) and primary access key (`<primary-access-key>`):
39
39
40
40
```dos
41
41
dotnet user-secrets set CacheConnection "<cache name>.redis.cache.windows.net,abortConnect=false,ssl=true,allowAdmin=true,password=<primary-access-key>"
@@ -50,14 +50,14 @@ The connection to your cache is managed by the `RedisConnection` class. First, y
50
50
51
51
```
52
52
53
-
In *RedisConnection.cs*, the `StackExchange.Redis` namespace has been added to the code. The namespace is required for the `RedisConnection` class.
53
+
In *RedisConnection.cs*, the `StackExchange.Redis` namespace was added to the code. The namespace is required for the `RedisConnection` class.
54
54
55
55
```csharp
56
56
usingStackExchange.Redis;
57
57
58
58
```
59
59
60
-
The `RedisConnection` code ensures that there is always a healthy connection to the cache by managing the `ConnectionMultiplexer` instance from `StackExchange.Redis`. The `RedisConnection` class re-creates the connection when a connection is lost and unable to reconnect automatically.
60
+
The `RedisConnection` code ensures that there's always a healthy connection to the cache by managing the `ConnectionMultiplexer` instance from `StackExchange.Redis`. The `RedisConnection` class re-creates the connection when a connection is lost and unable to reconnect automatically.
61
61
62
62
For more information, see [StackExchange.Redis](https://stackexchange.github.io/StackExchange.Redis/) and the code in a [GitHub repo](https://github.com/StackExchange/StackExchange.Redis).
63
63
@@ -147,7 +147,7 @@ If you opened any files, save the files. Then, build the app by using the follow
147
147
dotnet build
148
148
```
149
149
150
-
Run the app with the following command to test serialization of .NET objects:
150
+
To test serialization of .NET objects, run this command:
Copy file name to clipboardExpand all lines: articles/azure-cache-for-redis/cache-rust-get-started.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,13 +24,13 @@ You'll use the [redis-rs](https://github.com/mitsuhiko/redis-rs) library for Red
24
24
25
25
This article describes how to create an app by using the Azure portal and then modify the code to end up with a working sample app.
26
26
27
-
If you want to skip straight to the code, see the [Rust quickstart](https://github.com/Azure-Samples/azure-redis-cache-rust-quickstart/) on GitHub.
27
+
If you want to skip straight to the code, see the [Rust sample quickstart](https://github.com/Azure-Samples/azure-redis-cache-rust-quickstart/) on GitHub.
28
28
29
29
## Prerequisites
30
30
31
-
- Azure subscription - [create one for free](https://azure.microsoft.com/free/)
32
-
-[Rust](https://www.rust-lang.org/tools/install) (version 1.39 or above)
33
-
-[Git](https://git-scm.com/downloads)
31
+
* Azure subscription - [create one for free](https://azure.microsoft.com/free/)
32
+
*[Rust](https://www.rust-lang.org/tools/install) (version 1.39 or above)
33
+
*[Git](https://git-scm.com/downloads)
34
34
35
35
## Create a cache
36
36
@@ -92,7 +92,7 @@ fn basics() {
92
92
}
93
93
```
94
94
95
-
The below code snippet demonstrates the functionality of a Redis `HASH` data structure. [HSET](https://redis.io/commands/hset) is invoked by using the low-level API to store information (`name`, `version`, `repo`) about Redis drivers (clients). For example, details for the Rust driver (one being used in this sample code!) is captured in form of a [BTreeMap](https://doc.rust-lang.org/std/collections/struct.BTreeMap.html) and then passed on to the low-level API. It's then retrieved by using [HGETALL](https://redis.io/commands/hgetall).
95
+
The following code snippet demonstrates the functionality of a Redis `HASH` data structure. [HSET](https://redis.io/commands/hset) is invoked by using the low-level API to store information (`name`, `version`, `repo`) about Redis drivers (clients). For example, details for the Rust driver (one being used in this sample code!) is captured in the form of a [BTreeMap](https://doc.rust-lang.org/std/collections/struct.BTreeMap.html). Then, it's passed on to the low-level API. Finally, you retrieve it by using [HGETALL](https://redis.io/commands/hgetall).
96
96
97
97
`HSET` can also be executed by using a high-level API. [hset_multiple](https://docs.rs/redis/0.19.0/redis/trait.Commands.html#method.hset_multiple) accepts an array of tuples. [hget](https://docs.rs/redis/0.19.0/redis/trait.Commands.html#method.hget) is then executed to fetch the value for a single attribute (the value for `repo`, in this case).
# Quickstart: Use Azure Cache for Redis with an ASP.NET web app
14
14
15
-
In this quickstart, you use Visual Studio 2019 to create an ASP.NET web application that connects to Azure Cache for Redis to store and retrieve data from the cache. You then deploy the app to Azure App Service.
15
+
In this quickstart, you use Visual Studio 2019 to create an ASP.NET web application that connects to Azure Cache for Redis to store and gets data from the cache. Then, you deploy the app to Azure App Service.
16
16
17
17
## Skip to the code
18
18
@@ -31,11 +31,11 @@ Next, you create the cache for the app.
1. Create a file on your computer named *CacheSecrets.config*. Put it in a location where it won't be checked in with the source code of your sample application. For this quickstart, the *CacheSecrets.config* file is located at *C:\AppSecrets\CacheSecrets.config*.
36
+
1. Create a file on your computer named *CacheSecrets.config*. Put the file in a location where it isn't checked in with the source code of your sample application. For this quickstart, the *CacheSecrets.config* file is located at *C:\AppSecrets\CacheSecrets.config*.
37
37
38
-
1. Edit the *CacheSecrets.config* file. Then, add the following content:
38
+
1. Edit the *CacheSecrets.config* file to add the following content:
39
39
40
40
```xml
41
41
<appSettings>
@@ -55,39 +55,39 @@ Next, you create the cache for the app.
55
55
56
56
## Update the MVC application
57
57
58
-
In this section, an MVC application displays a simple test against the connection to Azure Cache for Redis.
58
+
In this section, a model-view-controller (MVC) application displays a simple test for the connection to Azure Cache for Redis.
59
59
60
60
### How the web.config file connects to the cache
61
61
62
-
When you run the application locally, the information in *CacheSecrets.config* is used to connect to your Azure Cache for Redis instance. Later, you can deploy this application to Azure. At that time, you configure an app setting in Azure that the application uses to retrieve the cache connection information instead of this file.
62
+
When you run the application locally, the information in *CacheSecrets.config* is used to connect to your Azure Cache for Redis instance. Later, you can deploy this application to Azure. At that time, you configure an app setting in Azure that the application uses to retrieve the cache connection information instead of using the config file.
63
63
64
-
Because the file *CacheSecrets.config* isn't deployed to Azure with your application, you only use it while testing the application locally. Keep this information as secure as possible to prevent malicious access to your cache data.
64
+
Because the *CacheSecrets.config* file isn't deployed to Azure with your application, you use it only when you test the application locally. Keep this information as secure as possible to help prevent malicious access to your cache data.
65
65
66
-
#### To update the *web.config* file
66
+
### Update the web.config file
67
67
68
-
1. In **Solution Explorer**, open the *web.config* file.
68
+
1. In Solution Explorer, open the *web.config* file.
The ASP.NET runtime merges the contents of the external file with the markup in the `<appSettings>` element. The runtime ignores the file attribute if the specified file can't be found. Your secrets (the connection string to your cache) aren't included as part of the source code for the application. When you deploy your web app to Azure, the *CacheSecrets.config* file isn't deployed.
77
77
78
78
## Install StackExchange.Redis
79
79
80
-
Your solution needs the `StackExchange.Redis` package to run. Install it, with this procedure:
80
+
Your solution requires the `StackExchange.Redis` package to run. Install the `StackExchange.Redis` package by completing this procedure:
81
81
82
-
1. To configure the app to use the [StackExchange.Redis](https://github.com/StackExchange/StackExchange.Redis) NuGet package for Visual Studio, select **Tools > NuGet Package Manager > Package Manager Console**.
82
+
1. To configure the app to use the [StackExchange.Redis](https://github.com/StackExchange/StackExchange.Redis) NuGet package for Visual Studio, select **Tools** > **NuGet Package Manager** > **Package Manager Console**.
83
83
84
-
1. Run the following command from the `Package Manager Console` window:
84
+
1. In the `Package Manager Console` window, run the following command:
85
85
86
86
```powershell
87
87
Install-Package StackExchange.Redis
88
88
```
89
89
90
-
1. The NuGet package downloads and adds the required assembly references for your client application to access Azure Cache for Redis with the `StackExchange.Redis` client.
90
+
1. The NuGet package downloads and adds the required assembly references for your client application to access Azure Cache for Redis by using the `StackExchange.Redis` client.
91
91
92
92
<!--
93
93
@@ -105,9 +105,9 @@ The connection to your cache is managed by the `RedisConnection` class. The conn
105
105
106
106
```
107
107
108
-
The value of the *CacheConnection* secret is accessed using the Secret Manager configuration provider and is used as the password parameter.
108
+
The value of the *CacheConnection* secret is accessed by using the Secret Manager configuration provider and is used as the password parameter.
109
109
110
-
In `RedisConnection.cs`, you see the `StackExchange.Redis` namespace has been added to the code. This is needed for the `RedisConnection` class.
110
+
In `RedisConnection.cs`, you see the `StackExchange.Redis` namespace was added to the code. This is needed for the `RedisConnection` class.
111
111
112
112
```csharp
113
113
usingStackExchange.Redis;
@@ -212,19 +212,19 @@ To publish the app in Azure:
212
212
| **App name** | Use the default. | The app name is the host name for the app when it's deployed to Azure. The name might have a timestamp suffix added to it to make it unique if necessary. |
213
213
| **Subscription** | Choose your Azure subscription. | This subscription is charged for any related hosting costs. If you have multiple Azure subscriptions, verify that the subscription that you want is selected.|
214
214
| **Resource group** | Use the same resource group where you created the cache (forexample, *TestResourceGroup*). |Theresourcegrouphelpsyoumanageallresourcesasagroup. Later, whenyouwanttodeletetheapp, youcanjustdeletethegroup. |
215
-
|**AppServiceplan**|Select**New**, andthencreateanewAppServiceplannamed*TestingPlan*. <br/>Usethesame**Location**youusedwhencreatingyourcache. <br/>Choose**Free**for the size. | An App Service plan defines a set of compute resources for a web app to run with. |
215
+
|**AppServiceplan**|Select**New**, andthencreateanewAppServiceplannamed*TestingPlan*. <br/>Usethesamevaluefor**Location** that you used when you created your cache. <br />For the size, select **Free**. | An App Service plan defines a set of compute resources for a web app to run with. |
216
216
217
217
:::image type="content" source="media/cache-web-app-howto/cache-create-app-service-dialog.png" alt-text="App Service dialog box":::
218
218
219
-
1. After you configure the App Service hosting settings, select **Create**.
219
+
1. After you configure the App Service host settings, select **Create**.
220
220
221
221
1. In the **Output** window in Visual Studio, check to see the publishing status. After the app is published, the URL for the app appears as output:
0 commit comments