| | |
| | | package com.genersoft.iot.vmp.utils.redis;
|
| | |
|
| | | import java.util.*;
|
| | | import java.util.concurrent.TimeUnit;
|
| | |
|
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.alibaba.fastjson2.JSONObject;
|
| | | import com.genersoft.iot.vmp.utils.SpringBeanFactory;
|
| | | import org.springframework.data.redis.core.*;
|
| | | import org.springframework.util.CollectionUtils;
|
| | |
|
| | | import java.util.*;
|
| | | import java.util.concurrent.TimeUnit;
|
| | |
|
| | | /**
|
| | | * Redis工具类
|
| | |
| | | * @param time 时间
|
| | | * @return true / false
|
| | | */
|
| | | public static boolean hmset(String key, Map<Object, Object> map, long time) {
|
| | | public static boolean hmset(String key, Map<?, ?> map, long time) {
|
| | | if (redisTemplate == null) {
|
| | | redisTemplate = SpringBeanFactory.getBean("redisTemplate");
|
| | | }
|
| | |
| | |
|
| | | return new ArrayList<>(resultKeys);
|
| | | }
|
| | |
|
| | | public static List<Object> scan2(String query) {
|
| | | if (redisTemplate == null) {
|
| | | redisTemplate = SpringBeanFactory.getBean("redisTemplate");
|
| | | }
|
| | | Set<String> keys = redisTemplate.keys(query);
|
| | | return new ArrayList<>(keys);
|
| | | }
|
| | | // ============================== 消息发送与订阅 ==============================
|
| | | public static void convertAndSend(String channel, JSONObject msg) {
|
| | | if (redisTemplate == null) {
|