当前位置: 首页>>代码示例>>Java>>正文


Java LettuceConnectionFactory类代码示例

本文整理汇总了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[]
}
 
开发者ID:spring-projects,项目名称:spring-session,代码行数:20,代码来源:IndexDocTests.java

示例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");
    }
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-aws,代码行数:15,代码来源:RedisCacheFactory.java

示例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();
    }
}
 
开发者ID:PacktPublishing,项目名称:Cloud-Foundry-For-Developers,代码行数:15,代码来源:HomeController.java

示例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;
}
 
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:14,代码来源:SessionConfig.java

示例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;
}
 
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:13,代码来源:SessionConfig.java

示例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);
}
 
开发者ID:spring-projects,项目名称:spring-session,代码行数:8,代码来源:AbstractRedisITests.java

示例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();
}
 
开发者ID:hantsy,项目名称:spring-reactive-sample,代码行数:5,代码来源:RedisConfig.java

示例10: connectionFactory

import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
public LettuceConnectionFactory connectionFactory() {
    return new LettuceConnectionFactory();
}
 
开发者ID:freedompy,项目名称:commelina,代码行数:5,代码来源:SpringSessionConfig.java

示例11: redisConnectionFactory

import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
public RedisConnectionFactory redisConnectionFactory() {
	return new LettuceConnectionFactory();
}
 
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:5,代码来源:RedisTestConfiguration.java

示例12: connectionFactory

import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
public LettuceConnectionFactory connectionFactory() {
	return new LettuceConnectionFactory();
}
 
开发者ID:selzlein,项目名称:spring-session-redis-demo,代码行数:5,代码来源:Config.java

示例13: redisConnectionFactory

import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
@Primary
public LettuceConnectionFactory redisConnectionFactory() {
	return new LettuceConnectionFactory(redisContainer().getContainerIpAddress(),
			redisContainer().getFirstMappedPort());
}
 
开发者ID:spring-projects,项目名称:spring-session,代码行数:7,代码来源:EmbeddedRedisConfig.java

示例14: connectionFactory

import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
public LettuceConnectionFactory connectionFactory() {
	return new LettuceConnectionFactory(); // <2>
}
 
开发者ID:spring-projects,项目名称:spring-session,代码行数:5,代码来源:Config.java

示例15: redisConnectionFactory

import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; //导入依赖的package包/类
@Bean
public LettuceConnectionFactory redisConnectionFactory() {
	return new LettuceConnectionFactory(redisContainer.getContainerIpAddress(),
			redisContainer.getFirstMappedPort());
}
 
开发者ID:spring-projects,项目名称:spring-session,代码行数:6,代码来源:RestMockMvcTests.java


注:本文中的org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。