jedis(java操作的中间件)
测试连接
依赖
<dependencies>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.62</version>
</dependency>
</dependencies>
编码测试
import redis.clients.jedis.Jedis;
public class TestPing {
public static void main(String[] args) {
//1、new redis对象即可
Jedis jedis=new Jedis("127.0.0.1",6379);
//jedis所有指令就是我们之前所有指令
System.out.println(jedis.ping());
}
}