当前位置:网站首页>jedispool工具类
jedispool工具类
2022-06-22 05:11:00 【a good idea】
@Configuration
public class RedisConfig extends CachingConfigurerSupport {
protected static final Logger logger = LoggerFactory.getLogger(RedisConfig.class);
@Value("${spring.redis.host}")
private String host;
@Value("${spring.redis.port}")
private int port;
@Value("${spring.redis.jedis.pool.max-active}")
private int maxTotal;
@Value("${spring.redis.jedis.pool.max-idle}")
private int maxIdle;
@Value("${spring.redis.jedis.pool.min-idle}")
private int minIdle;
@Value("${spring.redis.password}")
private String password;
@Value("${spring.redis.timeout}")
private int timeout;
public JedisPool redisPoolFactory() {
JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
jedisPoolConfig.setMaxTotal(maxTotal);
jedisPoolConfig.setMaxIdle(maxIdle);
jedisPoolConfig.setMinIdle(minIdle);
JedisPool jedisPool = null;
if(password == null || password.equals("")){
jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout);
}else{
jedisPool = new JedisPool(jedisPoolConfig, host, port, timeout,password);
}
logger.info("JedisPool注入成功!!");
logger.info("redis地址:" + host + ":" + port);
return jedisPool;
}
}边栏推荐
- What problems will be encountered during the implementation of MES management system
- Database - basic knowledge
- Liunx virtual machine environment uses docker to install Oracle database and Navicat to connect
- Restframework read and non read sequence processing
- Progress warning and problem management of progress control in Zhiyuan project management SPM system
- 在Vs Code中搭建JSP开发环境
- Gateway uses global filter for token verification
- 下拉刷新,上推加载(简单好用,终于会了)
- go学习(一、基础语法)
- Contents of 2022 tea master (intermediate) examination and tea master (intermediate) examination
猜你喜欢

Six sides tmall has already offered. After a review of my experience, is it really that difficult to enter a big factory?

Contents of 2022 tea master (intermediate) examination and tea master (intermediate) examination

Will swift compile to native code- Does Swift compile to native code?

Qt保存QTextEdit内存至.txt文件中

Lottie components make animation easier

laravel的服务容器,服务提供者,门面的理解

Solutions to MySQL 8.0 public key retrieval is not allowed errors

8. Gateway request logging

数据库---基础知识

7. Gateway global filter
随机推荐
Build JSP development environment in vs Code
Solutions to MySQL 8.0 public key retrieval is not allowed errors
1108. Defanging an IP Address
软件架构与模式:结构、组件、关系
mysql day03课堂笔记
[details] domestic website filing process and steps
Free questions for polymerization process and test papers for polymerization process in 2022
Target detection algorithm based on deep learning interview essential (rcnn~yolov5)
Liunx virtual machine environment uses docker to install Oracle database and Navicat to connect
NLP 的 不可能三角?
Qt保存QTextEdit内存至.txt文件中
Tupu software 2D and 2.5D case collection | smart Park, data center, SMT production line
1108. Defanging an IP Address
MySQL day01 class notes
C语言自定义函数的一些注意事项
在Vs Code中搭建JSP开发环境
restframework读取和非读取序列处理
Kubernetes——部署应用到集群中
mysql day02课堂笔记
Will swift compile to native code- Does Swift compile to native code?