Redis的基本操作

 

 

 

 

 

 

 

 

 

 

package com.redis;import java.util.Map;import redis.clients.jedis.Jedis;
public class RedisTest {
   public static void main(String[] args) {
       Jedis jedis = new Jedis("localhost");
       jedis.hset("student.scofield", "English", "45");
       jedis.hset("student.scofield", "Math", "89");
       jedis.hset("student.scofield", "Computer", "100");
       Map<String, String> value = jedis.hgetAll("student.scofield");
       for (Map.Entry<String, String> entry : value.entrySet()) {
           System.out.println(entry.getKey() + ":" + entry.getValue());
       }
   }}

 

posted @ 2020-11-08 21:48  yizhixiaozhu  阅读(49)  评论(0编辑  收藏  举报