Skip to content

Commit 70cb277

Browse files
DOC-4816 added advanced config options
1 parent 8e03e26 commit 70cb277

File tree

1 file changed

+38
-0
lines changed
  • content/develop/clients/jedis

1 file changed

+38
-0
lines changed

content/develop/clients/jedis/amr.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ Some of the details you can supply are common to different use cases:
7676
with the
7777
[Microsoft Authentication Library (MSAL)](https://learn.microsoft.com/en-us/entra/identity-platform/msal-overview)
7878

79+
(See [Advanced configuration options](#advanced-configuration-options) below
80+
to learn more about the options for controlling token request retry and timeout
81+
behavior.)
82+
7983
You can also add configuration to authenticate with a [service principal](#serv-principal)
8084
or a [managed identity](#mgd-identity) as described in the sections below.
8185

@@ -163,3 +167,37 @@ UnifiedJedis jedis = new UnifiedJedis(
163167
// Test the connection.
164168
System.out.println(String.format("Database size is %d", jedis.dbSize()));
165169
```
170+
171+
## Advanced configuration options
172+
173+
The `TokenAuthConfig` class has several other options that you can
174+
set with the `EntraIDTokenAuthConfigBuilder.builder()`. These give you
175+
more precise control over the way the token is renewed:
176+
177+
```java
178+
TokenAuthConfig authConfig = EntraIDTokenAuthConfigBuilder.builder()
179+
.expirationRefreshRatio(0.75)
180+
.lowerRefreshBoundMillis(100)
181+
.tokenRequestExecTimeoutInMs(100)
182+
.maxAttemptsToRetry(10)
183+
.delayInMsToRetry()
184+
// ...
185+
.build();
186+
```
187+
188+
These options are explained below:
189+
190+
- `expirationRefreshRatio`: a `float` value representing the fraction
191+
of a token's lifetime that should elapse before attempting to
192+
refresh it. For example, a value of 0.75 means that you want to
193+
refresh the token after 75% of its lifetime has passed.
194+
- `lowerRefreshBoundMillis`: the minimum amount of the token's lifetime
195+
(in milliseconds) remaining before attempting to refresh, regardless
196+
of the `expirationRefreshRatio` value. Set this to zero if you want
197+
the refresh time to depend only on `expirationRefreshRatio`.
198+
- `tokenRequestExecTimeoutInMs`: the maximum time (in milliseconds) to
199+
wait for a token request to complete before retrying.
200+
- `maxAttemptsToRetry`: the maximum number of times to retry a token
201+
request before aborting.
202+
- `delayInMsToRetry`: the time (in milliseconds) to wait before
203+
retrying a token request after a failed attempt.

0 commit comments

Comments
 (0)