遍历reids中的所有key、value、ttl

	public static void main(String[] args) throws InterruptedException {

		// 连接redis服务器,localhost:6379
		Jedis redis = new Jedis("dev-machine", 6379);

		while (true) {
			Set<String> keys = redis.keys("*");
			System.out.println("========   " + new Date().getSeconds() + "   ========");
			for (String key : keys) {
				System.out.println(redis.ttl(key) + "\t" + key + "\t" + redis.get(key));
			}
			System.out.println("\n\n===============================");
			Thread.sleep(1000);
		}
	}

你可能感兴趣的:(大数据学习)