1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- package com.ruoyi.common.utils.wechat;
- import com.ruoyi.common.constant.Constants;
- import com.ruoyi.common.core.domain.entity.SysDictData;
- import com.ruoyi.common.core.redis.RedisCache;
- import com.ruoyi.common.utils.StringUtils;
- import com.ruoyi.common.utils.spring.SpringUtils;
- import java.util.Collection;
- import java.util.List;
- /**
- * @Author ZhaoQian La
- * @Date 2021/6/16 9:40
- * @Version 1.0
- */
- /**
- * 版本控制工具类
- */
- public class VersionUtil {
- /**
- * 分隔符
- */
- public static final String SEPARATOR = ",";
- /**
- * 设置版本信息缓存
- *
- * @param key 参数键
- * @param dictDatas 版本信息数据列表
- */
- public static void setDictCache(String key, String dictDatas)
- {
- SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas);
- }
- /**
- * 获取字版本信息缓存
- *
- * @param key 参数键
- * @return dictDatas 版本信息数据列表
- */
- public static String getDictCache(String key)
- {
- String cacheObject = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key));
- if (StringUtils.isNotEmpty(cacheObject)){
- return cacheObject;
- }
- return null;
- }
- /**
- * 清空版本缓存
- */
- public static void clearDictCache(String configKey)
- {
- Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(Constants.SYS_VERSION_KEY + configKey);
- SpringUtils.getBean(RedisCache.class).deleteObject(keys);
- }
- /**
- * 设置cache key
- *
- * @param configKey 参数键
- * @return 缓存键key
- */
- public static String getCacheKey(String configKey)
- {
- return Constants.SYS_VERSION_KEY + configKey;
- }
- }
|