com.github.unclecatmyself.auto.RedisConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of InChat Show documentation
Show all versions of InChat Show documentation
A lightweight, efficient communication framework that supports chat and the Internet of Things
The newest version!
package com.github.unclecatmyself.auto;
import com.github.unclecatmyself.common.constant.LogConstant;
import com.sun.org.apache.regexp.internal.RE;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
/**
* 关于redis一些基础东西
* Create by UncleCatMySelf in 13:56 2019\1\5 0005
*/
public class RedisConfig {
private static final Logger log = LoggerFactory.getLogger(RedisConfig.class);
/** 单例模式 */
private static RedisConfig instance = new RedisConfig();
public static Jedis jedis;
/**
* 如果配置启动分布式,则自动初始化jedis
* */
private RedisConfig(){
if (ConfigFactory.initNetty.getDistributed()){
this.jedis = new Jedis(ConfigFactory.RedisIP);
log.info(LogConstant.REDIS_START + jedis.ping());
}
}
public static RedisConfig getInstance(){
return instance;
}
}