Skip to content

Commit

Permalink
Java: Update HttpClient Cache Docs (#1771)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatKuhr committed Apr 29, 2024
1 parent bbf061a commit 885e6f8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs-java/features/connectivity/005-http-client.mdx
Expand Up @@ -87,7 +87,8 @@ When the properties of `HttpClient` are not working for the application, e.g. ti
### Configuring the Cache

HTTP Clients are reused to ensure existing connections can be reused for better performance.
By default, clients are **cached for 5 minutes**.
By default, clients are **cached for at least one hour**.
Cache entries are only removed once the http client hasn't been accessed for one hour.
This can be configured to allow for better performance.

<Tabs
Expand All @@ -100,7 +101,7 @@ This can be configured to allow for better performance.
<TabItem value="v4">

```java
DefaultHttpClientCache cache = new DefaultHttpClientCache(1, TimeUnit.HOURS);
DefaultHttpClientCache cache = new DefaultHttpClientCache(1, TimeUnit.DAYS);
HttpClientAccessor.setHttpClientCache(cache);
```

Expand All @@ -109,7 +110,7 @@ HttpClientAccessor.setHttpClientCache(cache);

```java
ApacheHttpClient5Cache cache = new ApacheHttpClient5CacheBuilder()
.duration(Duration.ofHours(1)).build();
.duration(Duration.ofDays(1)).build();

ApacheHttpClient5Accessor.setHttpClientCache(cache);
```
Expand Down

0 comments on commit 885e6f8

Please sign in to comment.