stringRedisTemplate.getConnectionFactory().getConnection()获取pool中的redisConnection后,并没有后续操作,也就是说此时redis 连接池中的链接被租赁后并没有释放或者退还到链接池中,虽然业务已处理完毕 redisConnection 已经空闲,但是pool中的redisConnection的状态还没有回到idle状态
通过stringRedisTemplate.getConnectionFactory().getConnection()获取链接进行操作时打开了connection却没有关闭,应在业务逻辑使用完redis后通过RedisConnectionUtils.releaseConnection(conn, factory)来释放connection或者直接使用
stringRedisTemplate.execute(new RedisCallback() {
@Override
public Cursor doInRedis(RedisConnection connection) throws DataAccessException {
return connection.scan(options);
}
});