Trying to setup Lettuce Connection Pool in spring data redis environment.
Below is the code
@Bean
LettuceConnectionFactory redisConnectionFactory(GenericObjectPoolConfig genericObjectPoolConfig) {
RedisStandaloneConfiguration redisConfiguration = new RedisStandaloneConfiguration();
redisConfiguration.setHostName(hostName);
redisConfiguration.setPort(port);
redisConfiguration.setPassword(password);
redisConfiguration.setDatabase(databaseIndex);
LettuceClientConfiguration lettuceClientConfiguration= LettucePoolingClientConfiguration.builder().poolConfig(genericObjectPoolConfig).build();
return new LettuceConnectionFactory(redisConfiguration,lettuceClientConfiguration);
}
@Bean
public GenericObjectPoolConfig genericObjectPoolConfig(){
GenericObjectPoolConfig genericObjectPoolConfig=new GenericObjectPoolConfig();
genericObjectPoolConfig.setMaxTotal(100);
return genericObjectPoolConfig;
}
当我检查执行情况时,它没有考虑联线集合,每次都建立了联系。 就此提出的任何要点?