Skip to content
Snippets Groups Projects
Commit f9431c60 authored by Robert Lehmann's avatar Robert Lehmann Committed by Robert Lehmann
Browse files

connected to redis server

parent dfe7ccbf
No related branches found
No related tags found
No related merge requests found
......@@ -8,11 +8,42 @@ import com.yahoo.ycsb.DB;
import com.yahoo.ycsb.DBException;
import java.util.HashMap;
import java.util.Properties;
import java.util.Set;
import java.util.Vector;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.Protocol;
public class RedisClient extends DB {
private Jedis jedis;
public static final String HOST_PROPERTY = "redis.host";
public static final String PORT_PROPERTY = "redis.port";
public static final String PASSWORD_PROPERTY = "redis.password";
public void init() throws DBException {
Properties props = getProperties();
int port;
String portString = props.getProperty(PORT_PROPERTY);
if (portString != null) {
port = Integer.parseInt(portString);
}
else {
port = Protocol.DEFAULT_PORT;
}
String host = props.getProperty(HOST_PROPERTY);
jedis = new Jedis(host, port);
jedis.connect();
String password = props.getProperty(PASSWORD_PROPERTY);
if (password != null) {
jedis.auth(password);
jedis.flushAll();
}
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment