| | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Bean(name = "jedisPool") |
| | | @Autowired |
| | | //@Bean(name = "jedisPool") |
| | | //@Autowired |
| | | public JedisPool jedisPool(@Qualifier("jedis.pool.config") JedisPoolConfig config, |
| | | @Value("${jedis.pool.host}") String host, |
| | | @Value("${jedis.pool.port}") int port, |
| | |
| | | } |
| | | } |
| | | |
| | | @Bean(name = "jedisCluster") |
| | | @Autowired |
| | | |
| | | // @Bean(name = "jedisCluster") |
| | | // @Autowired |
| | | public JedisCluster jedisCluster(@Qualifier("jedis.pool.config") JedisPoolConfig config, |
| | | @Value("${jedis.pool.host}") String host, |
| | | @Value("${jedis.pool.port}") int port, |
| | |
| | | if (timeout == 0) { |
| | | timeout = 2000; |
| | | } |
| | | if (!host.contains(",")) { |
| | | return null; |
| | | } |
| | | |
| | | String[] hosts = host.split(","); |
| | | Set<HostAndPort> nodes = new HashSet<>(); |
| | | String[] tmpHosts = null; |
| | |
| | | } |
| | | JedisCluster cluster = new JedisCluster(nodes); |
| | | return cluster; |
| | | |
| | | } |
| | | |
| | | @Bean(name = "jedis.pool.config") |
| | | //@Bean(name = "jedis.pool.config") |
| | | public JedisPoolConfig jedisPoolConfig(@Value("${jedis.pool.config.maxTotal}") int maxTotal, |
| | | @Value("${jedis.pool.config.maxIdle}") int maxIdle, |
| | | @Value("${jedis.pool.config.maxWaitMillis}") int maxWaitMillis) { |