Jedis 入门级示例
package com.wallta.redis;import java.util.Iterator;import java.util.Set;import redis.clients.jedis.Jedis;public class RedisTest {public static void main(String[] args) {long start = System.currentTimeMillis();System.out.println("开始时间:" start);// 连接redis服务器,localhost:6379Jedis redis = new Jedis("192.168.1.188", 6379);redis.auth("redis");Set<String> sets = redis.keys("*");Iterator<String> it = sets.iterator();while(it.hasNext()) {String val = it.next();System.out.println(val);}System.out.println("结束时间:" System.currentTimeMillis());}}
评论