From a5e6a69003f869d667a462d3d0273437080de834 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 27 五月 2021 15:03:39 +0800
Subject: [PATCH] 优化代码

---
 java110-utils/src/main/java/com/java110/utils/cache/CommonCache.java |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/java110-utils/src/main/java/com/java110/utils/cache/CommonCache.java b/java110-utils/src/main/java/com/java110/utils/cache/CommonCache.java
old mode 100644
new mode 100755
index 526c09b..2fca35c
--- a/java110-utils/src/main/java/com/java110/utils/cache/CommonCache.java
+++ b/java110-utils/src/main/java/com/java110/utils/cache/CommonCache.java
@@ -1,5 +1,8 @@
 package com.java110.utils.cache;
 
+import com.java110.utils.util.DateUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import redis.clients.jedis.Jedis;
 
 /**
@@ -7,6 +10,7 @@
  */
 public class CommonCache extends BaseCache {
 
+    private final static Logger logger = LoggerFactory.getLogger(MappingCache.class);
 
     public final static int defaultExpireTime = 5 * 60;
     public final static int RESEND_DEFAULT_EXPIRETIME = 1 * 60;
@@ -14,8 +18,7 @@
     //鏀粯榛樿鍥炶瘽
     public final static int PAY_DEFAULT_EXPIRE_TIME = 2 * 60 * 60;
 
-    //鏃ュ織
-    public final static String LOG_SERVICE_CODE = "LOG_SERVICE_CODE";
+
 
     /**
      * 鑾峰彇鍊�(鐢ㄦ埛ID)
@@ -24,6 +27,8 @@
      */
     public static String getValue(String key) {
         Jedis redis = null;
+        long startTime = DateUtil.getCurrentDate().getTime();
+
         try {
             redis = getJedis();
             return redis.get(key);
@@ -31,6 +36,7 @@
             if (redis != null) {
                 redis.close();
             }
+            logger.debug( key + " redis 鑰楁椂锛�" + (DateUtil.getCurrentDate().getTime() - startTime));
         }
     }
 
@@ -42,6 +48,8 @@
     public static String getAndRemoveValue(String key) {
         Jedis redis = null;
         String value = "";
+        long startTime = DateUtil.getCurrentDate().getTime();
+
         try {
             redis = getJedis();
             value = redis.get(key);
@@ -50,6 +58,8 @@
             if (redis != null) {
                 redis.close();
             }
+            logger.debug( key + "getAndRemoveValue redis 鑰楁椂锛�" + (DateUtil.getCurrentDate().getTime() - startTime));
+
         }
         return value;
     }

--
Gitblit v1.8.0