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
@@ -33,49 +33,152 @@ Clone the repo [Java quickstart](https://github.com/Azure-Samples/azure-cache-re
33
33
34
34
Depending on your operating system, add environment variables for your **Host name** and **Primary access key** that you noted previously. Open a command prompt, or a terminal window, and set up the following values:
35
35
36
-
### [Linux](#tab/bash)
36
+
##[Microsoft Entra ID Authentication (recommended)](#tab/entraid)
Replace the placeholders with the following values:
53
56
54
57
-`<your-host-name>`: The DNS host name, obtained from the *Properties* section of your Azure Cache for Redis resource in the Azure portal.
55
58
-`<your-primary-access-key>`: The primary access key, obtained from the *Access keys* section of your Azure Cache for Redis resource in the Azure portal.
56
59
57
-
## Understand the Java sample
60
+
---
61
+
58
62
59
-
In this sample, you use Maven to run the quickstart app.
63
+
## Create a new Java app
60
64
61
-
1. Change to the new *redistest* project directory.
//Construct a Token Credential from Identity library, e.g. DefaultAzureCredential / ClientSecretCredential / Client CertificateCredential / ManagedIdentityCredential etc.
@@ -127,6 +230,9 @@ In this sample, you use Maven to run the quickstart app.
127
230
}
128
231
```
129
232
233
+
---
234
+
235
+
130
236
This code shows you how to connect to an AzureCacheforRedis instance using the cache host name and key environment variables. The code also stores and retrieves a string value in the cache. The `PING` and `CLIENTLIST` commands are also executed.
131
237
132
238
1.Close the *App.java*.
@@ -135,40 +241,30 @@ In this sample, you use Maven to run the quickstart app.
135
241
136
242
1.First, if you haven't already, you must set the environment variables as noted previously.
137
243
138
-
### [Linux](#tab/bash)
244
+
## [Microsoft Entra ID Authentication (recommended)](#tab/entraid)
1. Execute the following Maven command to build and run the app:
155
262
156
-
### [Linux](#tab/bash)
157
-
158
263
```bash
159
264
mvn compile
160
265
mvn exec:java -D exec.mainClass=example.demo.App
161
266
```
162
267
163
-
### [Windows](#tab/cmd)
164
-
165
-
```cmd
166
-
mvn compile
167
-
mvn exec:java -D exec.mainClass=example.demo.App
168
-
```
169
-
170
-
---
171
-
172
268
In the following output, you can see that the `Message` key previously had a cached value. The value was updated to a new value using `jedis.set`. The app also executed the `PING` and `CLIENT LIST` commands.
0 commit comments