加依赖
<!--redis依赖--> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.9.0</version> </dependency>
public class redisDemo { public static void main(String[] args) { // 连接redis Jedis jedis=new Jedis("ip...",6379); jedis.auth("root");//在redis有密码时需要写这步 System.out.println(jedis.ping()); jedis.set("name","aaa"); System.out.println(jedis.get("name")); // 使用完关闭连接 jedis.close(); } }
标签:java,redis,System,jedis,操作,Jedis,out From: https://www.cnblogs.com/liweimingbk/p/17517393.html