org.springframework.data.redis.connection.RedisClusterConfiguration Java Examples
The following examples show how to use
org.springframework.data.redis.connection.RedisClusterConfiguration.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RateLimiterPluginDataHandler.java From soul with Apache License 2.0 | 5 votes |
private RedisClusterConfiguration redisClusterConfiguration(final RateLimiterConfig rateLimiterConfig) { RedisClusterConfiguration config = new RedisClusterConfiguration(); config.setClusterNodes(createRedisNode(rateLimiterConfig.getUrl())); if (rateLimiterConfig.getPassword() != null) { config.setPassword(RedisPassword.of(rateLimiterConfig.getPassword())); } return config; }
Example #2
Source File: JedisRedisInitializer.java From spring-fu with Apache License 2.0 | 5 votes |
private JedisConnectionFactory getJedisConnectionFactory(GenericApplicationContext context) { final JedisConnectionConfiguration configuration = new JedisConnectionConfiguration(redisProperties, context.getBeanProvider(RedisSentinelConfiguration.class), context.getBeanProvider(RedisClusterConfiguration.class)); try { return configuration.redisConnectionFactory(context.getBeanProvider(JedisClientConfigurationBuilderCustomizer.class)); } catch (UnknownHostException e) { throw new IllegalStateException(e); } }
Example #3
Source File: LettuceRedisInitializer.java From spring-fu with Apache License 2.0 | 5 votes |
private LettuceConnectionFactory getLettuceConnectionFactory(GenericApplicationContext context) { final LettuceConnectionConfiguration configuration = new LettuceConnectionConfiguration(redisProperties, context.getBeanProvider(RedisSentinelConfiguration.class), context.getBeanProvider(RedisClusterConfiguration.class)); final ClientResources clientResources = DefaultClientResources.create(); try { return configuration.redisConnectionFactory(context.getBeanProvider(LettuceClientConfigurationBuilderCustomizer.class), clientResources); } catch (UnknownHostException e) { throw new IllegalStateException(e); } }
Example #4
Source File: MultiCacheAutoConfig.java From gateway-helper with Apache License 2.0 | 5 votes |
public RedisConfig(RedisProperties properties, ObjectProvider<RedisSentinelConfiguration> sentinelConfiguration, ObjectProvider<RedisClusterConfiguration> clusterConfiguration) { this.properties = properties; this.sentinelConfiguration = sentinelConfiguration.getIfAvailable(); this.clusterConfiguration = clusterConfiguration.getIfAvailable(); }
Example #5
Source File: MultiCacheAutoConfig.java From api-gateway-old with Apache License 2.0 | 5 votes |
public RedisConfig(RedisProperties properties, ObjectProvider<RedisSentinelConfiguration> sentinelConfiguration, ObjectProvider<RedisClusterConfiguration> clusterConfiguration) { this.properties = properties; this.sentinelConfiguration = sentinelConfiguration.getIfAvailable(); this.clusterConfiguration = clusterConfiguration.getIfAvailable(); }
Example #6
Source File: JedisClusterConfig.java From tx-lcn with Apache License 2.0 | 5 votes |
/** * redisCluster配置 * @return */ @Bean public RedisClusterConfiguration redisClusterConfiguration() { Map<String, Object> source = new HashMap<String, Object>(); source.put("spring.redis.cluster.nodes", redisProperties.getNodes()); source.put("spring.redis.cluster.timeout", redisProperties.getCommandTimeout()); return new RedisClusterConfiguration(new MapPropertySource("RedisClusterConfiguration", source)); }
Example #7
Source File: AppConfig.java From pcc-like with Apache License 2.0 | 5 votes |
public RedisClusterConfiguration redisClusterConfiguration() { RedisClusterConfiguration clusterConfig = new RedisClusterConfiguration(); clusterConfig.clusterNode(env.getProperty("spring.redis.host"), Integer.parseInt(env.getProperty("spring.redis.port"))); clusterConfig.setMaxRedirects(10000); return clusterConfig; }
Example #8
Source File: RedisConfUtils.java From storm_spring_boot_demo with MIT License | 5 votes |
/** * {@link org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration#getClusterConfiguration} * @param redisProperties * @return */ public static RedisClusterConfiguration getClusterConfiguration(RedisProperties redisProperties) { if (redisProperties.getCluster() == null) { return null; } RedisProperties.Cluster clusterProperties = redisProperties.getCluster(); RedisClusterConfiguration config = new RedisClusterConfiguration( clusterProperties.getNodes()); if (clusterProperties.getMaxRedirects() != null) { config.setMaxRedirects(clusterProperties.getMaxRedirects()); } return config; }
Example #9
Source File: ClusterInitializer.java From spring-fu with Apache License 2.0 | 4 votes |
@Override public void initialize(GenericApplicationContext context) { if (cluster != null) { context.registerBean(RedisClusterConfiguration.class, this::getRedisClusterConfiguration); } }
Example #10
Source File: ClusterInitializer.java From spring-fu with Apache License 2.0 | 4 votes |
@NotNull private RedisClusterConfiguration getRedisClusterConfiguration() { final RedisClusterConfiguration configuration = new RedisClusterConfiguration(cluster.getNodes()); configuration.setMaxRedirects(cluster.getMaxRedirects()); return configuration; }
Example #11
Source File: RedisClusterConnection.java From syncer with BSD 3-Clause "New" or "Revised" License | 4 votes |
public RedisClusterConfiguration getConfig() { RedisClusterConfiguration configuration = new RedisClusterConfiguration( getClusterNodes()); configuration.setPassword(RedisPassword.of(getPassword())); return configuration; }
Example #12
Source File: MultiConnectionConfiguration.java From dew with Apache License 2.0 | 4 votes |
public MultiConnectionConfiguration(RedisProperties properties, ObjectProvider<RedisSentinelConfiguration> sentinelConfigurationProvider, ObjectProvider<RedisClusterConfiguration> clusterConfigurationProvider) { super(properties, sentinelConfigurationProvider, clusterConfigurationProvider); }