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


Java RedisSentinelConfiguration类代码示例

本文整理汇总了Java中org.springframework.data.redis.connection.RedisSentinelConfiguration的典型用法代码示例。如果您正苦于以下问题:Java RedisSentinelConfiguration类的具体用法?Java RedisSentinelConfiguration怎么用?Java RedisSentinelConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RedisSentinelConfiguration类属于org.springframework.data.redis.connection包,在下文中一共展示了RedisSentinelConfiguration类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSentinelConfig

import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
protected final RedisSentinelConfiguration getSentinelConfig() {
	if (StringUtils.hasText(sentinelNodes)) {
		RedisSentinelConfiguration config = new RedisSentinelConfiguration();
		config.master(sentinelMaster);
		config.setSentinels(createSentinels());
		return config;
	}
	return null;
}
 
开发者ID:spring-projects,项目名称:spring-xd-samples,代码行数:10,代码来源:RedisSourceConfiguration.java

示例2: sentinelConfig

import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
/**
 * redis哨兵配置
 * @return
 */
@Bean
public RedisSentinelConfiguration sentinelConfig(){
    if(this.clusterSentinels.size()<=0 ||
            this.clusterSentinels.get(0).length()==0){
        return null;
    }
    return new RedisSentinelConfiguration(this.clusterMaster,
            new HashSet<>(this.clusterSentinels));
}
 
开发者ID:tomoncle,项目名称:JavaStudy,代码行数:14,代码来源:RedisBeans.java

示例3: sentinelConnectionFactory

import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
/**
     *redis 主从
     * @return
     */
    @Bean(name="sentinelConnectionFactory")
    public RedisConnectionFactory sentinelConnectionFactory(
            JedisPoolConfig poolConfig,
            RedisSentinelConfiguration sentinelConfig){
        if(sentinelConfig!=null){
            JedisConnectionFactory jcf=new JedisConnectionFactory(sentinelConfig,poolConfig);
            jcf.setHostName(this.host);
            jcf.setPort(this.port);
            jcf.setTimeout(timeout);
//            jcf.setPassword(this.password);
            return jcf;
        }
        return connectionFactory(poolConfig);
    }
 
开发者ID:tomoncle,项目名称:JavaStudy,代码行数:19,代码来源:RedisBeans.java

示例4: test

import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
@org.junit.Test
public void test(){
    String  user_prefix="user_";
    User user=new User(1,"aric");
    ApplicationContext atc=new AnnotationConfigApplicationContext(RedisStartConfig.class);
    RedisTemplate<String,User> obj = (RedisTemplate) atc.getBean("redisTemplate");
    PrinterUtils.printILog(obj.getKeySerializer());
    obj.opsForValue().set(user_prefix+user.getId(),user);
    RedisSentinelConfiguration RedisSentinelConfiguration = (RedisSentinelConfiguration) atc.getBean("sentinelConfig");
    PrinterUtils.printILog(RedisSentinelConfiguration);
    User value=obj.opsForValue().get(user_prefix+1);
    PrinterUtils.printELog(value.getUsername());
}
 
开发者ID:tomoncle,项目名称:JavaStudy,代码行数:14,代码来源:Test.java

示例5: RedisConnectionConfiguration

import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
public RedisConnectionConfiguration(RedisProperties properties,
		ObjectProvider<RedisSentinelConfiguration> sentinelConfigurationProvider,
		ObjectProvider<RedisClusterConfiguration> clusterConfigurationProvider) {
	this.properties = properties;
	this.sentinelConfiguration = sentinelConfigurationProvider.getIfAvailable();
	this.clusterConfiguration = clusterConfigurationProvider.getIfAvailable();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:RedisAutoConfiguration.java

示例6: getSentinelConfig

import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
protected final RedisSentinelConfiguration getSentinelConfig() {
	if (this.sentinelConfiguration != null) {
		return this.sentinelConfiguration;
	}
	Sentinel sentinelProperties = this.properties.getSentinel();
	if (sentinelProperties != null) {
		RedisSentinelConfiguration config = new RedisSentinelConfiguration();
		config.master(sentinelProperties.getMaster());
		config.setSentinels(createSentinels(sentinelProperties));
		return config;
	}
	return null;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:RedisAutoConfiguration.java

示例7: jedisConnectionFactory

import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
@Bean
public JedisConnectionFactory jedisConnectionFactory(){
	RedisSentinelConfiguration sentinelConfig = new RedisSentinelConfiguration() 
			.master("mymaster")
			.sentinel("127.0.0.1", 26379) 
			.sentinel("127.0.0.1", 26380);
	return new JedisConnectionFactory(sentinelConfig);
}
 
开发者ID:felipeg48,项目名称:redis-examples,代码行数:9,代码来源:RedisSpringConfigApplication.java

示例8: RequiresRedisSentinel

import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
protected RequiresRedisSentinel(RedisSentinelConfiguration config) {
	this.sentinelConfig = config;
}
 
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:4,代码来源:RequiresRedisSentinel.java

示例9: sentinelConfig

import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
public @Bean RedisSentinelConfiguration sentinelConfig() {
	return SENTINEL_CONFIG;
}
 
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:4,代码来源:RedisSentinelApplication.java

示例10: HwRedisConnectionFactory

import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
public HwRedisConnectionFactory(RedisSentinelConfiguration sentinelConfig, JedisPoolConfig poolConfig) {
    this.sentinelConfig = sentinelConfig;
    this.poolConfig = poolConfig != null ? poolConfig : new JedisPoolConfig();
}
 
开发者ID:Fourwenwen,项目名称:consistent-hashing-redis,代码行数:5,代码来源:HwRedisConnectionFactory.java

示例11: getSentinelConfig

import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
public RedisSentinelConfiguration getSentinelConfig() {
    return sentinelConfig;
}
 
开发者ID:Fourwenwen,项目名称:consistent-hashing-redis,代码行数:4,代码来源:HwRedisConnectionFactory.java

示例12: setSentinelConfig

import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
public void setSentinelConfig(RedisSentinelConfiguration sentinelConfig) {
    this.sentinelConfig = sentinelConfig;
}
 
开发者ID:Fourwenwen,项目名称:consistent-hashing-redis,代码行数:4,代码来源:HwRedisConnectionFactory.java

示例13: forConfig

import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
/**
 * Create new {@link RedisSentinelRule} for given {@link RedisSentinelConfiguration}.
 * 
 * @param config
 * @return
 */
public static RequiresRedisSentinel forConfig(RedisSentinelConfiguration config) {
	return new RequiresRedisSentinel(config != null ? config : DEFAULT_SENTINEL_CONFIG);
}
 
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:10,代码来源:RequiresRedisSentinel.java


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