
org.caiguoqing.uyuni.config.RedisConfig Maven / Gradle / Ivy
The newest version!
/**
*
*/
package org.caiguoqing.uyuni.config;
import java.io.InputStream;
import java.util.Properties;
/**
* @author caiguoqing0427
*
*/
public class RedisConfig extends Config {
private static String host;
private static int port;
private static int database;
private static String pass;
private static int timeout;
static{
InputStream is = RedisConfig.class
.getResourceAsStream("/redis.properties");
Properties p = new Properties();
try {
p.load(is);
host = p.getProperty("redis.host");
port = Integer.parseInt(p.getProperty("redis.port"));
database = Integer.parseInt(p.getProperty("redis.database"));
pass = p.getProperty("redis.pass");
timeout = Integer.parseInt(p.getProperty("redis.timeout"));
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
}
public String getHost() {
return host;
}
public int getPort() {
return port;
}
public int getDatabase() {
return database;
}
public String getPass() {
return pass;
}
public int getTimeout(){
return timeout;
}
@Override
public String toString() {
return "RedisConfig [getHost()=" + getHost() + ", getPort()=" + getPort() + ", getDatabase()=" + getDatabase()
+ ", getPass()=" + getPass() + ", getTimeout()=" + getTimeout() + "]";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy