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 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; } }