I had different objects, saved in redis
. This objects has different structures.
I need to use custom codec to serialize and deserialize it.
I had three beans.
@Bean(destroyMethod = "shutdown")
public RedissonClient redissonClientA() {
Config config = getConfig();
config.setCodec(new ObjectABaseCodec(objectMapper));
return Redisson.create(config);
}
@Bean(destroyMethod = "shutdown")
public RedissonClient redissonClientB() {
Config config = getConfig();
config.setCodec(new ObjectBBaseCodec(objectMapper));
return Redisson.create(config);
}
@Bean(destroyMethod = "shutdown")
public RedissonClient redissonClientC() {
Config config = getConfig();
config.setCodec(new ObjectCBaseCodec(objectMapper));
return Redisson.create(config);
}
And I had three redisson client with three objects with connections to redis. And in nearest future we planned add new objects. And I don't want increase count of connections to redis.
First Idea: I want, but I don't wont how share redisson connection pool between several redisson clients.
Second Idea:use common codec and inside common codec decide which object I have and after that use current codec implementation.
Maybe you know how i can realize first idea?