import redis.clients.jedis.*;
public class JedisExample {
public static void main(String[] args) {
Jedis jedis = new Jedis("localhost", 6379);
jedis.set("key", "value");
String value = jedis.get("key");
System.out.println(value);
Transaction transaction = jedis.multi();
transaction.set("key1", "value1");
transaction.set("key2", "value2");
transaction.exec();
jedis.close();
}
}
JedisPoolConfig poolConfig = new JedisPoolConfig();
JedisPool jedisPool = new JedisPool(poolConfig, "localhost", 6379);
Jedis jedis = jedisPool.getResource();