Skip to content

Commit 32b29e8

Browse files
authored
replace port with REDIS_CACHE_PORT
1 parent b19eebb commit 32b29e8

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

articles/azure-cache-for-redis/cache-java-get-started.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,10 @@ Clone the repo [Java quickstart](https://github.com/Azure-Samples/azure-cache-re
127127

128128
String cacheHostname = System.getenv("REDIS_CACHE_HOSTNAME");
129129
String username = System.getenv("USER_NAME");
130+
int port = Integer.parseInt(System.getenv().getOrDefault("REDIS_CACHE_PORT", "6380"));
130131

131132
// Connect to the Azure Cache for Redis over the TLS/SSL port using the key.
132-
Jedis jedis = new Jedis(cacheHostname, 6380, DefaultJedisClientConfig.builder()
133+
Jedis jedis = new Jedis(cacheHostname, port, DefaultJedisClientConfig.builder()
133134
.password(token) // Microsoft Entra access token as password is required.
134135
.user(username) // Username is Required
135136
.ssl(useSsl) // SSL Connection is Required
@@ -180,9 +181,10 @@ Clone the repo [Java quickstart](https://github.com/Azure-Samples/azure-cache-re
180181
boolean useSsl = true;
181182
String cacheHostname = System.getenv("REDIS_CACHE_HOSTNAME");
182183
String cachekey = System.getenv("REDIS_CACHE_KEY");
184+
int port = Integer.parseInt(System.getenv().getOrDefault("REDIS_CACHE_PORT", "6380"));
183185

184186
// Connect to the Azure Cache for Redis over the TLS/SSL port using the key.
185-
Jedis jedis = new Jedis(cacheHostname, 6380, DefaultJedisClientConfig.builder()
187+
Jedis jedis = new Jedis(cacheHostname, port, DefaultJedisClientConfig.builder()
186188
.password(cachekey)
187189
.ssl(useSsl)
188190
.build());

articles/azure-cache-for-redis/cache-java-redisson-get-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ This quickstart uses the Maven archetype feature to generate the scaffolding for
164164
// Connect to the Azure Cache for Redis over the TLS/SSL port using the key
165165
Config redissonconfig = new Config();
166166
redissonconfig.useSingleServer()
167-
.setAddress(String.format("rediss://%s:6380", System.getenv("REDIS_CACHE_HOSTNAME")))
167+
.setAddress(String.format("rediss://%s:%s", System.getenv("REDIS_CACHE_HOSTNAME"), System.getenv("REDIS_CACHE_PORT")))
168168
.setUsername(System.getenv("USER_NAME")) // (Required) Username is Object ID of your managed identity or service principal
169169
.setPassword(token); // Microsoft Entra access token as password is required.
170170
return redissonconfig;
@@ -228,7 +228,7 @@ This quickstart uses the Maven archetype feature to generate the scaffolding for
228228
// Connect to the Azure Cache for Redis over the TLS/SSL port using the key
229229
Config redissonconfig = new Config();
230230
redissonconfig.useSingleServer().setPassword(System.getenv("REDIS_CACHE_KEY"))
231-
.setAddress(String.format("rediss://%s:6380", System.getenv("REDIS_CACHE_HOSTNAME")));
231+
.setAddress(String.format("rediss://%s:%s", System.getenv("REDIS_CACHE_HOSTNAME"), System.getenv("REDIS_CACHE_PORT")));
232232
return redissonconfig;
233233
}
234234
}

0 commit comments

Comments
 (0)