Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java: Update HttpClient Cache Docs #1771

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs-java/features/connectivity/005-http-client.mdx
Original file line number Diff line number Diff line change
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