org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration Java Examples
The following examples show how to use
org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration.
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: LettuceConnFactoryProvider.java From sofa-dashboard-client with Apache License 2.0 | 5 votes |
public LettuceConnectionFactory createFactory(ClientResources clientResources) { LettuceClientConfiguration clientConfig = getLettuceClientConfiguration(clientResources, this.properties.getLettuce().getPool()); LettuceConnectionFactory factory = createLettuceConnectionFactory(clientConfig); factory.afterPropertiesSet(); return factory; }
Example #2
Source File: LettuceConnFactoryProvider.java From sofa-dashboard-client with Apache License 2.0 | 5 votes |
private LettuceConnectionFactory createLettuceConnectionFactory(LettuceClientConfiguration clientConfiguration) { if (getSentinelConfig() != null) { return new LettuceConnectionFactory(getSentinelConfig(), clientConfiguration); } if (getClusterConfiguration() != null) { return new LettuceConnectionFactory(getClusterConfiguration(), clientConfiguration); } return new LettuceConnectionFactory(getStandaloneConfig(), clientConfiguration); }
Example #3
Source File: LettuceConnFactoryProvider.java From sofa-dashboard-client with Apache License 2.0 | 5 votes |
private LettuceClientConfiguration getLettuceClientConfiguration(ClientResources clientResources, Pool pool) { LettuceClientConfigurationBuilder builder = createBuilder(pool); applyProperties(builder); if (StringUtils.hasText(this.properties.getUrl())) { customizeConfigurationFromUrl(builder); } builder.clientResources(clientResources); return builder.build(); }
Example #4
Source File: RedisAutoConfig.java From unimall with Apache License 2.0 | 5 votes |
/**** 缓存专用数据源 ****/ @Bean public LettuceConnectionFactory defaultLettuceConnectionFactory( RedisStandaloneConfiguration defaultRedisConfig,GenericObjectPoolConfig defaultPoolConfig) { LettuceClientConfiguration clientConfig = LettucePoolingClientConfiguration.builder().commandTimeout(Duration.ofMillis(5000)) .poolConfig(defaultPoolConfig).build(); return new LettuceConnectionFactory(defaultRedisConfig, clientConfig); }
Example #5
Source File: RedisAutoConfig.java From unimall with Apache License 2.0 | 5 votes |
/**** 用户SESSION专用数据源 ****/ @Bean public LettuceConnectionFactory userLettuceConnectionFactory( RedisStandaloneConfiguration userRedisConfig,GenericObjectPoolConfig userPoolConfig) { LettuceClientConfiguration clientConfig = LettucePoolingClientConfiguration.builder().commandTimeout(Duration.ofMillis(5000)) .poolConfig(userPoolConfig).build(); return new LettuceConnectionFactory(userRedisConfig, clientConfig); }
Example #6
Source File: RedisAutoConfig.java From unimall with Apache License 2.0 | 5 votes |
/**** 锁专用数据源 ****/ @Bean public LettuceConnectionFactory lockLettuceConnectionFactory( RedisStandaloneConfiguration lockRedisConfig,GenericObjectPoolConfig lockPoolConfig) { LettuceClientConfiguration clientConfig = LettucePoolingClientConfiguration.builder().commandTimeout(Duration.ofMillis(5000)) .poolConfig(lockPoolConfig).build(); return new LettuceConnectionFactory(lockRedisConfig, clientConfig); }
Example #7
Source File: RateLimiterPluginDataHandler.java From soul with Apache License 2.0 | 5 votes |
private LettuceConnectionFactory createLettuceConnectionFactory(final RateLimiterConfig rateLimiterConfig) { LettuceClientConfiguration lettuceClientConfiguration = getLettuceClientConfiguration(rateLimiterConfig); if (RedisModeEnum.SENTINEL.getName().equals(rateLimiterConfig.getMode())) { return new LettuceConnectionFactory(redisSentinelConfiguration(rateLimiterConfig), lettuceClientConfiguration); } else if (RedisModeEnum.CLUSTER.getName().equals(rateLimiterConfig.getMode())) { return new LettuceConnectionFactory(redisClusterConfiguration(rateLimiterConfig), lettuceClientConfiguration); } return new LettuceConnectionFactory(redisStandaloneConfiguration(rateLimiterConfig), lettuceClientConfiguration); }
Example #8
Source File: RedisConfiguration.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Bean public LettuceConnectionFactory lettuceConnectionFactory() { LettuceClientConfigurationBuilder builder = LettuceClientConfiguration.builder(); if(Boolean.parseBoolean( (String) redisSslEnabled().getObject())) { builder.useSsl(); } LettuceClientConfiguration clientConfiguration = builder.build(); RedisStandaloneConfiguration standaloneConfig = new RedisStandaloneConfiguration(); standaloneConfig.setHostName( (String) redisHost().getObject() ); standaloneConfig.setPassword( (String) redisPassword().getObject() ); standaloneConfig.setPort( Integer.parseInt( (String) redisPort().getObject() ) ); return new LettuceConnectionFactory( standaloneConfig, clientConfiguration ); }
Example #9
Source File: RedisConfig.java From spring-boot-redis-guava-caffeine-cache with Apache License 2.0 | 5 votes |
@Bean @Primary public LettuceConnectionFactory factoryA(GenericObjectPoolConfig config, RedisStandaloneConfiguration redisConfigA) { LettuceClientConfiguration clientConfiguration = LettucePoolingClientConfiguration.builder() .poolConfig(config).commandTimeout(Duration.ofMillis(config.getMaxWaitMillis())).build(); return new LettuceConnectionFactory(redisConfigA, clientConfiguration); }
Example #10
Source File: RedisConnectionFactoryCloudConfigTestHelper.java From spring-cloud-connectors with Apache License 2.0 | 5 votes |
public static void assertNoPoolProperties(RedisConnectionFactory connector) { if (connector instanceof JedisConnectionFactory) { assertFalse(((JedisConnectionFactory) connector).getUsePool()); } else if (connector instanceof LettuceConnectionFactory) { LettuceClientConfiguration config = ((LettuceConnectionFactory) connector).getClientConfiguration(); assertThat(config, instanceOf(LettuceClientConfiguration.class)); } }
Example #11
Source File: RedisConnectionFactoryCloudConfigTestHelper.java From spring-cloud-connectors with Apache License 2.0 | 5 votes |
public static void assertPoolProperties(RedisConnectionFactory connector, int maxActive, int minIdle, long maxWait) { GenericObjectPoolConfig poolConfig = null; if (connector instanceof JedisConnectionFactory) { poolConfig = ((JedisConnectionFactory) connector).getPoolConfig(); } else if (connector instanceof LettuceConnectionFactory) { LettuceClientConfiguration config = ((LettuceConnectionFactory) connector).getClientConfiguration(); assertThat(config, instanceOf(LettucePoolingClientConfiguration.class)); poolConfig = ((LettucePoolingClientConfiguration) config).getPoolConfig(); } assertCommonsPoolProperties(poolConfig, maxActive, minIdle, maxWait); }
Example #12
Source File: LettuceConnFactoryProvider.java From sofa-dashboard-client with Apache License 2.0 | 4 votes |
private LettuceClientConfigurationBuilder createBuilder(Pool pool) { if (pool == null) { return LettuceClientConfiguration.builder(); } return new PoolBuilderFactory().createBuilder(pool); }
Example #13
Source File: RateLimiterPluginDataHandler.java From soul with Apache License 2.0 | 4 votes |
private LettuceClientConfiguration getLettuceClientConfiguration(final RateLimiterConfig rateLimiterConfig) { return LettucePoolingClientConfiguration.builder().poolConfig(getPoolConfig(rateLimiterConfig)).build(); }
Example #14
Source File: RedisConfig.java From spring-boot-redis-guava-caffeine-cache with Apache License 2.0 | 4 votes |
@Bean public LettuceConnectionFactory factoryB(GenericObjectPoolConfig config, RedisStandaloneConfiguration redisConfigB) { LettuceClientConfiguration clientConfiguration = LettucePoolingClientConfiguration.builder() .poolConfig(config).commandTimeout(Duration.ofMillis(config.getMaxWaitMillis())).build(); return new LettuceConnectionFactory(redisConfigB, clientConfiguration); }
Example #15
Source File: RedisSentinelApplication.java From spring-data-examples with Apache License 2.0 | 4 votes |
public @Bean RedisConnectionFactory connectionFactory() { return new LettuceConnectionFactory(sentinelConfig(), LettuceClientConfiguration.defaultConfiguration()); }