From c65ab218b14e87489f1594b2d932f7bd54b3ba11 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 17 十月 2025 13:34:19 +0800
Subject: [PATCH] 数采调整
---
ruoyi-common/src/main/java/com/ruoyi/common/utils/RedisUtil.java | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/RedisUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RedisUtil.java
index ed0d3ae..fd82b06 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/RedisUtil.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RedisUtil.java
@@ -471,7 +471,7 @@
* @param start 寮�濮�
* @param end 缁撴潫 0 鍒� -1浠h〃鎵�鏈夊��
*/
- public static List<Object> lGet(String key, long start, long end) {
+ public static List<?> lGet(String key, long start, long end) {
try {
return redisTemplate.opsForList().range(key, start, end);
} catch (Exception e) {
@@ -557,7 +557,7 @@
* @param value 鍊�
* @return true 瀛樻斁鎴愬姛 false瀛樻斁澶辫触
*/
- public static boolean lSet(String key, List<Object> value) {
+ public static boolean lSet(String key, List<?> value) {
try {
redisTemplate.opsForList().rightPushAll(key, value);
return true;
@@ -577,7 +577,7 @@
* @param time 鏃堕棿(绉�)
* @return true 瀛樻斁鎴愬姛 false瀛樻斁澶辫触
*/
- public static boolean lSet(String key, List<Object> value, long time) {
+ public static boolean lSet(String key, List<?> value, long time) {
try {
if (time > 0) {
redisTemplate.opsForList().rightPushAll(key, value);
@@ -628,5 +628,54 @@
return 0;
}
}
+
+ //====================================================ZSet=======================================================
+
+ /**
+ * 鑾峰彇zset鏁版嵁闀垮害
+ * @param key 閿�
+ * @return
+ */
+ public static long getZSetSize(String key){
+ try {
+ return redisTemplate.opsForZSet().size(key);
+ }catch (Exception e){
+ e.printStackTrace();
+ return 0L;
+ }
+ }
+
+ /**
+ * 鏂板涓�涓獄set
+ * @param key 閿�
+ * @param source 鍒嗘暟
+ * @param value 鍊�
+ * @return
+ */
+ public static boolean addZSet(String key,double source,Object value){
+ try {
+ return redisTemplate.opsForZSet().add(key, value, source);
+ }catch(Exception e){
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ /**
+ * 鍒犻櫎zset鍏冪礌锛屾寜鎺掑悕
+ * @param key 閿�
+ * @param start 寮�濮嬬储寮�
+ * @param end 缁撴潫绱㈠紩
+ * @return
+ */
+ public static long delZSetRange(String key,long start,long end){
+ try {
+ return redisTemplate.opsForZSet().removeRange(key,start,end);
+ }catch(Exception e){
+ e.printStackTrace();
+ return 0L;
+ }
+ }
+
}
--
Gitblit v1.9.3