目录
一、Java连接Redis
1、pom依赖
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
</dependency>
2、Java链接
package com.cxy.redis;
import redis.clients.jedis.Jedis;
public class demo1 {
public static void main(String[] args) {
Jedis jedis = new Jedis("192.168.186.128", 6379);
jedis.auth("123456");
System.out.println(jedis.ping());
}
}
运行结果