From db5abf468e5f2d00e51f8bd4a267484879a73451 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 08 五月 2021 12:51:18 +0800
Subject: [PATCH] 推送服务完善

---
 lib-common/src/main/java/com/ks/lib/common/util/RedisUtil.java |   62 +++++-------------------------
 1 files changed, 11 insertions(+), 51 deletions(-)

diff --git a/lib-common/src/main/java/com/ks/lib/common/util/RedisUtil.java b/lib-common/src/main/java/com/ks/lib/common/util/RedisUtil.java
index 4588e26..d3ad2b9 100644
--- a/lib-common/src/main/java/com/ks/lib/common/util/RedisUtil.java
+++ b/lib-common/src/main/java/com/ks/lib/common/util/RedisUtil.java
@@ -42,7 +42,7 @@
      */
 
     public long getExpire(String key) {
-        return redisTemplate.getExpire(key, TimeUnit.SECONDS);
+        return redisTemplate.getExpire(key);
     }
 
     /**
@@ -346,7 +346,7 @@
      * @return
      */
 
-    public double hincr(String key, String item, double by) {
+    public double hincr(String key, String item, long by) {
 
         return redisTemplate.opsForHash().increment(key, item, by);
 
@@ -361,7 +361,7 @@
      * @return
      */
 
-    public double hdecr(String key, String item, double by) {
+    public double hdecr(String key, String item, long by) {
 
         return redisTemplate.opsForHash().increment(key, item, -by);
 
@@ -409,12 +409,12 @@
      * @param values 鍊� 鍙互鏄涓�
      * @return 鎴愬姛涓暟
      */
-    public long sSet(String key, Object... values) {
+    public boolean sSet(String key, Object... values) {
         try {
             return redisTemplate.opsForSet().add(key, values);
         } catch (Exception e) {
             e.printStackTrace();
-            return 0;
+            return false;
         }
     }
 
@@ -426,15 +426,15 @@
      * @param values 鍊� 鍙互鏄涓�
      * @return 鎴愬姛涓暟
      */
-    public long sSetAndTime(String key, long time, Object... values) {
+    public boolean sSetAndTime(String key, long time, Object... values) {
         try {
-            Long count = redisTemplate.opsForSet().add(key, values);
+          boolean count = redisTemplate.opsForSet().add(key, values);
             if (time > 0)
                 expire(key, time);
             return count;
         } catch (Exception e) {
             e.printStackTrace();
-            return 0;
+            return false;
         }
     }
 
@@ -461,13 +461,12 @@
      * @return 绉婚櫎鐨勪釜鏁�
      */
 
-    public long setRemove(String key, Object... values) {
+    public boolean setRemove(String key, Object... values) {
         try {
-            Long count = redisTemplate.opsForSet().remove(key, values);
-            return count;
+          return redisTemplate.opsForSet().remove(key, values);
         } catch (Exception e) {
             e.printStackTrace();
-            return 0;
+            return false;
         }
     }
 
@@ -564,45 +563,6 @@
         }
     }
 
-    /**
-     * 灏唋ist鏀惧叆缂撳瓨
-     *
-     * @param key   閿�
-     * @param value 鍊�
-     * @return
-     */
-
-    public boolean lSet(String key, List<Object> value) {
-        try {
-            redisTemplate.opsForList().rightPushAll(key, value);
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
-
-    /**
-     * 灏唋ist鏀惧叆缂撳瓨
-     *
-     * @param key   閿�
-     * @param value 鍊�
-     * @param time  鏃堕棿(绉�)
-     * @return
-     */
-
-    public boolean lSet(String key, List<Object> value, long time) {
-        try {
-            redisTemplate.opsForList().rightPushAll(key, value);
-            if (time > 0) {
-                expire(key, time);
-            }
-            return true;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-    }
 
     /**
      * 鏍规嵁绱㈠紩淇敼list涓殑鏌愭潯鏁版嵁

--
Gitblit v1.8.0