From e6790d88fc5b1ac33d239c0d90ce6cdea666b821 Mon Sep 17 00:00:00 2001 From: mk1990 <153958232@qq.com> Date: 星期一, 16 五月 2022 10:14:24 +0800 Subject: [PATCH] Merge branch 'wvp-28181-2.0' of https://github.com/mk1990/wvp-GB28181-pro into wvp-28181-2.0 --- src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java | 52 +++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java b/src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java index f83d5f3..8ab0672 100644 --- a/src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java +++ b/src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java @@ -3,13 +3,14 @@ import java.util.*; import java.util.concurrent.TimeUnit; +import com.alibaba.fastjson.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.*; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; /** - * @Description:Redis宸ュ叿绫� + * @description:Redis宸ュ叿绫� * @author: swwheihei * @date: 2020骞�5鏈�6鏃� 涓嬪崍8:27:29 */ @@ -396,7 +397,7 @@ * @param value * @param score */ - public void zAdd(String key, String value, double score) { + public void zAdd(Object key, Object value, double score) { redisTemplate.opsForZSet().add(key, value, score); } @@ -406,7 +407,7 @@ * @param key * @param value */ - public void zRemove(String key, String value) { + public void zRemove(Object key, Object value) { redisTemplate.opsForZSet().remove(key, value); } @@ -415,10 +416,10 @@ * * @param key * @param value - * @param score + * @param delta -1 琛ㄧず鍑� 1 琛ㄧず鍔�1 */ - public Double zIncrScore(String key, String value, double score) { - return redisTemplate.opsForZSet().incrementScore(key, value, score); + public Double zIncrScore(Object key, Object value, double delta) { + return redisTemplate.opsForZSet().incrementScore(key, value, delta); } /** @@ -428,7 +429,7 @@ * @param value * @return */ - public Double zScore(String key, String value) { + public Double zScore(Object key, Object value) { return redisTemplate.opsForZSet().score(key, value); } @@ -439,7 +440,7 @@ * @param value * @return */ - public Long zRank(String key, String value) { + public Long zRank(Object key, Object value) { return redisTemplate.opsForZSet().rank(key, value); } @@ -449,7 +450,7 @@ * @param key * @return */ - public Long zSize(String key) { + public Long zSize(Object key) { return redisTemplate.opsForZSet().zCard(key); } @@ -463,7 +464,7 @@ * @param end * @return */ - public Set<String> ZRange(String key, int start, int end) { + public Set<Object> ZRange(Object key, int start, int end) { return redisTemplate.opsForZSet().range(key, start, end); } /** @@ -474,7 +475,7 @@ * @param end * @return */ - public Set<ZSetOperations.TypedTuple<String>> zRangeWithScore(String key, int start, int end) { + public Set<ZSetOperations.TypedTuple<String>> zRangeWithScore(Object key, int start, int end) { return redisTemplate.opsForZSet().rangeWithScores(key, start, end); } /** @@ -487,7 +488,7 @@ * @param end * @return */ - public Set<String> zRevRange(String key, int start, int end) { + public Set<String> zRevRange(Object key, int start, int end) { return redisTemplate.opsForZSet().reverseRange(key, start, end); } /** @@ -498,7 +499,7 @@ * @param max * @return */ - public Set<String> zSortRange(String key, int min, int max) { + public Set<String> zSortRange(Object key, int min, int max) { return redisTemplate.opsForZSet().rangeByScore(key, min, max); } @@ -660,6 +661,24 @@ } /** + * 鍦ㄩ敭涓� key 鐨� list涓Щ闄ょ涓�涓厓绱� + * @param key 閿� + * @return + */ + public Object lLeftPop(String key) { + return redisTemplate.opsForList().leftPop(key); + } + + /** + * 鍦ㄩ敭涓� key 鐨� list涓Щ闄ゃ�佹渶鍚庝竴涓厓绱� + * @param key 閿� + * @return + */ + public Object lrightPop(String key) { + return redisTemplate.opsForList().rightPop(key); + } + + /** * 妯$硦鏌ヨ * @param key 閿� * @return true / false @@ -729,4 +748,11 @@ return new ArrayList<>(keys); } + // ============================== 娑堟伅鍙戦�佷笌璁㈤槄 ============================== + public void convertAndSend(String channel, JSONObject msg) { +// redisTemplate.convertAndSend(channel, msg); + redisTemplate.convertAndSend(channel, msg); + + } + } -- Gitblit v1.8.0