From 8ab2ad5580212b91df848e4c127f2a682485fde3 Mon Sep 17 00:00:00 2001
From: zhouxiang <zhouxiang>
Date: 星期一, 25 四月 2022 01:49:15 +0800
Subject: [PATCH] 修改common

---
 src/main/java/com/hx/redis/RedisUtil.java |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/hx/redis/RedisUtil.java b/src/main/java/com/hx/redis/RedisUtil.java
index f4cf4ed..dbcfa16 100644
--- a/src/main/java/com/hx/redis/RedisUtil.java
+++ b/src/main/java/com/hx/redis/RedisUtil.java
@@ -1,13 +1,9 @@
 package com.hx.redis;
 
-import org.junit.Before;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Component;
-import redis.clients.jedis.Jedis;
 
 import javax.annotation.Resource;
-import java.util.Date;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
@@ -180,4 +176,35 @@
             return false;
         }
     }
+
+    /**
+     * hash 鑾峰彇鏁翠釜hashKey鏁版嵁
+     *
+     * @param hashKey   閿�
+     * @return true鎴愬姛 false 澶辫触
+     */
+    public Map<Object, Object> hashGetAll(String hashKey) {
+        try {
+            return redisTemplate.opsForHash().entries(hashKey);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * hash 鑾峰彇鍗曚釜hashKey
+     *
+     * @param hashKey   閿�
+     * @return true鎴愬姛 false 澶辫触
+     */
+    public Object hashGet(String hashKey,String key) {
+        try {
+            return redisTemplate.opsForHash().get(hashKey,key);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
 }

--
Gitblit v1.8.0