From 7381f42dbec55951a0db5125d30886d1bdcad6a1 Mon Sep 17 00:00:00 2001
From: fhx <308050795@qq.com>
Date: 星期五, 12 五月 2023 10:54:42 +0800
Subject: [PATCH] 1.日期工具新增方法

---
 src/main/java/com/hx/redis/RedisUtil.java |   20 ++++++++++++++++++++
 1 files changed, 20 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..d9b582b 100644
--- a/src/main/java/com/hx/redis/RedisUtil.java
+++ b/src/main/java/com/hx/redis/RedisUtil.java
@@ -141,6 +141,26 @@
 
     }
 
+    /**
+     * 璁剧疆鍒版湡鏃堕棿
+     * @param key       瀵瑰簲閿�
+     * @param time      鏃堕暱
+     * @param timeUnit  鏃堕棿鍗曚綅
+     * @return
+     */
+    public boolean expire(String key, long time, TimeUnit timeUnit) {
+        try {
+            if (time > 0) {
+                return redisTemplate.expire(key, time, timeUnit);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+
+        }
+        return false;
+    }
+
 
     /**
      * hash 鍒犻櫎鎿嶄綔

--
Gitblit v1.8.0