Sharing a RedisClusterClient among different clusters is possible? #2083
-
I'm aware you can share a single RedisClient instance to connect to several standalone redis servers, obtaining a different StatefulRedisConnection for each of them. This is desirable as RedisClient is a very expensive object. Now, is it possible to do the same with a RedisClusterClient? This is, obtaining different StatefulRedisClusterConnection's for different clusters? API design seems to imply no, as there's no RedisClusterClient.create() method, without parameters, as there is in the RedisClient's case. Nor there is a RedisClusterClient.connect(RedisURI) method, like there is in the other case. Now, I would like to know:
Thx very much in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
RedisClusterClient
is designed to work with a single cluster. It keeps the topology and refresh mechanics for a single cluster and doesn't allow to switch between clusters. You can instantiate a secondRedisClusterClient
instance for your other cluster. Just make sure to reuse event loops by providing a managedClientResources
instance to not create duplicate I/O thread pools.