From 2aad5c6ca552423d1b8e6e8c869a698a15822759 Mon Sep 17 00:00:00 2001
From: fhx <308050795@qq.com>
Date: 星期二, 25 四月 2023 15:32:39 +0800
Subject: [PATCH] 1.修改redis工具

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

diff --git a/src/main/java/com/hx/redis/RedisUtil.java b/src/main/java/com/hx/redis/RedisUtil.java
index e17cf25..6f380eb 100644
--- a/src/main/java/com/hx/redis/RedisUtil.java
+++ b/src/main/java/com/hx/redis/RedisUtil.java
@@ -141,6 +141,27 @@
 
     }
 
+    /**
+     * 璁剧疆鍒版湡鏃堕棿
+     * @param key       瀵瑰簲閿�
+     * @param time      鏃堕暱
+     * @param timeUnit  鏃堕棿鍗曚綅
+     * @return
+     */
+    public boolean expire(String key, long time, TimeUnit timeUnit) {
+        try {
+            if (time > 0) {
+                redisTemplate.expire(key, time, timeUnit);
+            }
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+
+        }
+
+    }
+
 
     /**
      * hash 鍒犻櫎鎿嶄綔

--
Gitblit v1.8.0