Skip to content

Commit 5e19f1b

Browse files
committed
Redis Client: add sentinel topology cache TTL configuration
The config option is still called `hash-slot-cache-ttl`, but is now applied to both the cluster-only hash slot cache and sentinel-only topology cache. This is to avoid deprecations and allow backporting to LTS Quarkus.
1 parent ca0c6c9 commit 5e19f1b

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/client/VertxRedisClientFactory.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ public void accept(Set<URI> uris) {
100100
options.setPassword(config.password().orElse(null));
101101
config.poolCleanerInterval().ifPresent(d -> options.setPoolCleanerInterval((int) d.toMillis()));
102102
config.poolRecycleTimeout().ifPresent(d -> options.setPoolRecycleTimeout((int) d.toMillis()));
103-
options.setHashSlotCacheTTL(config.hashSlotCacheTtl().toMillis());
103+
// the Vert.x Redis client will only unify `topologyCacheTTL` and `hashSlotCacheTTL` in version 5.1,
104+
// but in Quarkus, we unify them already
105+
long topologyCacheTtl = config.hashSlotCacheTtl().toMillis();
106+
options.setHashSlotCacheTTL(topologyCacheTtl);
107+
options.setTopologyCacheTTL(topologyCacheTtl);
104108

105109
config.role().ifPresent(options::setRole);
106110
options.setType(config.clientType());

extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/client/config/RedisClientConfig.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ public interface RedisClientConfig {
148148
Optional<ProtocolVersion> preferredProtocolVersion();
149149

150150
/**
151-
* The TTL of the hash slot cache. A hash slot cache is used by the clustered Redis client
152-
* to prevent constantly sending {@code CLUSTER SLOTS} commands to the first statically
153-
* configured cluster node.
151+
* The TTL of the topology cache. A topology cache is used by a clustered Redis client
152+
* and a sentinel Redis client to prevent constantly sending topology discovery commands
153+
* ({@code CLUSTER SLOTS} or {@code SENTINEL ...}).
154154
* <p>
155-
* This setting is only meaningful in case of a clustered Redis client and has no effect
156-
* otherwise.
155+
* This setting is only meaningful in case of a clustered Redis client and a sentinel
156+
* Redis client and has no effect otherwise.
157157
*/
158158
@WithDefault("1s")
159159
Duration hashSlotCacheTtl();

0 commit comments

Comments
 (0)