1、下载jedis的jar包
http://repo1.maven.org/maven2/redis/clients/jedis/2.8.1/
2、启动redis后台
3、测试联通
package com.pjf.redis.ping;
import redis.clients.jedis.Jedis;
public class PingTest {
public static void main(String[] args) {
Jedis jedis = new Jedis("127.0.0.1", 6379);
System.out.println(jedis.ping());
System.out.println(jedis.get("k1"));
}
}
4、输出
PONG
v1
很简单,api和redis后台命令命名差不多