
org.kaizen4j.starter.redis.RedisProperties Maven / Gradle / Ivy
package org.kaizen4j.starter.redis;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.List;
@ConfigurationProperties(prefix = "redis", ignoreUnknownFields = false)
public class RedisProperties {
private int database = 0;
private String host = "localhost";
private String password;
private int port = 6379;
private boolean ssl;
// 单位毫秒
private int timeout = 6000;
private RedisProperties.Cluster cluster;
private final RedisProperties.Jedis jedis = new RedisProperties.Jedis();
public RedisProperties() {}
public int getDatabase() {
return this.database;
}
public void setDatabase(int database) {
this.database = database;
}
public String getHost() {
return this.host;
}
public void setHost(String host) {
this.host = host;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public int getPort() {
return this.port;
}
public void setPort(int port) {
this.port = port;
}
public boolean isSsl() {
return this.ssl;
}
public void setSsl(boolean ssl) {
this.ssl = ssl;
}
public int getTimeout() {
return timeout;
}
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public RedisProperties.Cluster getCluster() {
return this.cluster;
}
public void setCluster(RedisProperties.Cluster cluster) {
this.cluster = cluster;
}
public RedisProperties.Jedis getJedis() {
return this.jedis;
}
public static class Jedis {
private RedisProperties.Pool pool;
public Jedis() {}
public RedisProperties.Pool getPool() {
return this.pool;
}
public void setPool(RedisProperties.Pool pool) {
this.pool = pool;
}
}
public static class Cluster {
private List nodes;
private Integer maxRedirects = 6;
public Cluster() {}
public List getNodes() {
return this.nodes;
}
public void setNodes(List nodes) {
this.nodes = nodes;
}
public Integer getMaxRedirects() {
return this.maxRedirects;
}
public void setMaxRedirects(Integer maxRedirects) {
this.maxRedirects = maxRedirects;
}
}
public static class Pool {
private int maxIdle = 8;
private int minIdle = 0;
private int maxActive = 8;
// 连接池最大阻塞等待时间(使用负值表示没有限制)默认 -1
private int maxWait = -1;
public Pool() {}
public int getMaxIdle() {
return this.maxIdle;
}
public void setMaxIdle(int maxIdle) {
this.maxIdle = maxIdle;
}
public int getMinIdle() {
return this.minIdle;
}
public void setMinIdle(int minIdle) {
this.minIdle = minIdle;
}
public int getMaxActive() {
return this.maxActive;
}
public void setMaxActive(int maxActive) {
this.maxActive = maxActive;
}
public int getMaxWait() {
return maxWait;
}
public void setMaxWait(int maxWait) {
this.maxWait = maxWait;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy