From 43b9abed7ec0129910cefd84033b576e755f4b97 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期日, 07 八月 2022 19:29:28 +0800
Subject: [PATCH] 新增删除Hash中的某条数据
---
src/main/java/com/ruoyi/framework/redis/RedisCache.java | 38 +++++++++++++++++++++++++-------------
1 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/src/main/java/com/ruoyi/framework/redis/RedisCache.java b/src/main/java/com/ruoyi/framework/redis/RedisCache.java
index 1e674db..da5329a 100644
--- a/src/main/java/com/ruoyi/framework/redis/RedisCache.java
+++ b/src/main/java/com/ruoyi/framework/redis/RedisCache.java
@@ -62,6 +62,19 @@
}
/**
+ * 璁剧疆鏈夋晥鏃堕棿
+ *
+ * @param key Redis閿�
+ * @param timeout 瓒呮椂鏃堕棿
+ * @param unit 鏃堕棿鍗曚綅
+ * @return true=璁剧疆鎴愬姛锛沠alse=璁剧疆澶辫触
+ */
+ public boolean expire(final String key, final long timeout, final TimeUnit unit)
+ {
+ return redisTemplate.expire(key, timeout, unit);
+ }
+
+ /**
* 鑾峰彇鏈夋晥鏃堕棿
*
* @param key Redis閿�
@@ -81,19 +94,6 @@
public Boolean hasKey(String key)
{
return redisTemplate.hasKey(key);
- }
-
- /**
- * 璁剧疆鏈夋晥鏃堕棿
- *
- * @param key Redis閿�
- * @param timeout 瓒呮椂鏃堕棿
- * @param unit 鏃堕棿鍗曚綅
- * @return true=璁剧疆鎴愬姛锛沠alse=璁剧疆澶辫触
- */
- public boolean expire(final String key, final long timeout, final TimeUnit unit)
- {
- return redisTemplate.expire(key, timeout, unit);
}
/**
@@ -256,6 +256,18 @@
}
/**
+ * 鍒犻櫎Hash涓殑鏌愭潯鏁版嵁
+ *
+ * @param key Redis閿�
+ * @param hKey Hash閿�
+ * @return 鏄惁鎴愬姛
+ */
+ public boolean deleteCacheMapValue(final String key, final String hKey)
+ {
+ return Boolean.TRUE.equals(redisTemplate.opsForHash().delete(key, hKey));
+ }
+
+ /**
* 鑾峰緱缂撳瓨鐨勫熀鏈璞″垪琛�
*
* @param pattern 瀛楃涓插墠缂�
--
Gitblit v1.9.3