本文整理汇总了Java中org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory类的典型用法代码示例。如果您正苦于以下问题:Java LettuceConnectionFactory类的具体用法?Java LettuceConnectionFactory怎么用?Java LettuceConnectionFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LettuceConnectionFactory类属于org.springframework.data.redis.connection.lettuce包,在下文中一共展示了LettuceConnectionFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newReactiveRedisOperationsSessionRepository
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Test
@SuppressWarnings("unused")
public void newReactiveRedisOperationsSessionRepository() {
LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory();
RedisSerializationContext<String, Object> serializationContext = RedisSerializationContext
.<String, Object>newSerializationContext(
new JdkSerializationRedisSerializer())
.build();
// tag::new-reactiveredisoperationssessionrepository[]
// ... create and configure connectionFactory and serializationContext ...
ReactiveRedisTemplate<String, Object> redisTemplate = new ReactiveRedisTemplate<>(
connectionFactory, serializationContext);
ReactiveSessionRepository<? extends Session> repository =
new ReactiveRedisOperationsSessionRepository(redisTemplate);
// end::new-reactiveredisoperationssessionrepository[]
}
示例2: createConnectionClient
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Override
protected RedisConnectionFactory createConnectionClient(String hostName, int port) {
RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration();
configuration.setHostName(hostName);
configuration.setPort(port);
if (JEDIS_AVAILABLE) {
return new JedisConnectionFactory(configuration);
} else if (LETTUCE_AVAILABLE) {
return new LettuceConnectionFactory(configuration);
} else {
throw new IllegalArgumentException("No Jedis or lettuce client on classpath. " +
"Please add one of the implementation to your classpath");
}
}
示例3: toString
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
private String toString(RedisConnectionFactory redisConnectionFactory) {
if (redisConnectionFactory == null) {
return "<none>";
} else {
if (redisConnectionFactory instanceof JedisConnectionFactory) {
JedisConnectionFactory jcf = (JedisConnectionFactory) redisConnectionFactory;
return jcf.getHostName().toString() + ":" + jcf.getPort();
} else if (redisConnectionFactory instanceof LettuceConnectionFactory) {
LettuceConnectionFactory lcf = (LettuceConnectionFactory) redisConnectionFactory;
return lcf.getHostName().toString() + ":" + lcf.getPort();
}
return "<unknown> " + redisConnectionFactory.getClass();
}
}
示例4: connectionFactory
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
public LettuceConnectionFactory connectionFactory() {
String redisHost = System.getenv().getOrDefault("REDIS_HOST_ENV", "192.168.99.100");
String redisPort = System.getenv().getOrDefault("REDIS_PORT_ENV", "6379");
System.out.println("Redis @ "+ redisHost + ":" + redisPort);
return new LettuceConnectionFactory(redisHost, Integer.valueOf(redisPort));
}
开发者ID:abhirockzz,项目名称:accs-tomcat-redis-springsession,代码行数:8,代码来源:RedisSessionStoreConfiguration.java
示例5: cloudRedisConnectionFactory
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Profile(GitHubClaProfiles.CLOUDFOUNDRY)
@Bean
public RedisConnectionFactory cloudRedisConnectionFactory() {
CloudFactory cloudFactory = new CloudFactory();
Cloud cloud = cloudFactory.getCloud();
RedisConnectionFactory connectionFactory = cloud.getSingletonServiceConnector(RedisConnectionFactory.class, null);
if(connectionFactory instanceof LettuceConnectionFactory){
((LettuceConnectionFactory) connectionFactory).setShutdownTimeout(0);
}
return connectionFactory;
}
示例6: redisConnectionFactory
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(RedisConnectionFactory.class)
public RedisConnectionFactory redisConnectionFactory(RedisProperties redisProperties) {
LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory();
connectionFactory.setPort(redisProperties.getPort());
connectionFactory.setHostName(redisProperties.getHost());
connectionFactory.setPassword(redisProperties.getPassword());
connectionFactory.setShutdownTimeout(0);
return connectionFactory;
}
示例7: redisConnectionFactory
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
public LettuceConnectionFactory redisConnectionFactory() {
RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration(
redisContainer.getContainerIpAddress(),
redisContainer.getFirstMappedPort());
return new LettuceConnectionFactory(configuration);
}
示例8: configure
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Override
public LettuceConnectionFactory configure(LettuceConnectionFactory connectionFactory, RedisConnectionFactoryConfig config) {
if (config != null) {
configureConnection(connectionFactory, config);
}
return connectionFactory;
}
开发者ID:spring-cloud,项目名称:spring-cloud-connectors,代码行数:8,代码来源:RedisLettuceConnectionFactoryConfigurer.java
示例9: redisConnectionFactory
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
public LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory();
}
示例10: connectionFactory
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
public LettuceConnectionFactory connectionFactory() {
return new LettuceConnectionFactory();
}
示例11: redisConnectionFactory
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
public RedisConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory();
}
示例12: connectionFactory
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
public LettuceConnectionFactory connectionFactory() {
return new LettuceConnectionFactory();
}
示例13: redisConnectionFactory
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
@Primary
public LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
redisContainer().getFirstMappedPort());
}
示例14: connectionFactory
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
public LettuceConnectionFactory connectionFactory() {
return new LettuceConnectionFactory(); // <2>
}
示例15: redisConnectionFactory
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
public LettuceConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(redisContainer.getContainerIpAddress(),
redisContainer.getFirstMappedPort());
}