diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-redis/src/main/java/com/orion/ops/framework/redis/core/utils/RedisMaps.java b/orion-ops-framework/orion-ops-spring-boot-starter-redis/src/main/java/com/orion/ops/framework/redis/core/utils/RedisMaps.java new file mode 100644 index 00000000..3b793444 --- /dev/null +++ b/orion-ops-framework/orion-ops-spring-boot-starter-redis/src/main/java/com/orion/ops/framework/redis/core/utils/RedisMaps.java @@ -0,0 +1,509 @@ +package com.orion.ops.framework.redis.core.utils; + +import com.alibaba.fastjson.JSON; +import com.orion.lang.define.cache.CacheKeyDefine; +import com.orion.lang.function.Functions; +import com.orion.lang.utils.Objects1; +import com.orion.lang.utils.collect.Lists; +import com.orion.lang.utils.collect.Maps; +import org.springframework.data.redis.core.HashOperations; + +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * redis hash 工具类 + * + * @author Jiahang Li + * @version 1.0.0 + * @since 2023/9/22 13:44 + */ +@SuppressWarnings("unchecked") +public class RedisMaps extends RedisUtils { + + private RedisMaps() { + } + + /** + * 插入数据 + * + * @param key key + * @param hashKey hashKey + * @param value value + */ + public static void put(CacheKeyDefine key, Object hashKey, Object value) { + put(key.getKey(), hashKey, value); + } + + /** + * 插入数据 + * + * @param key key + * @param hashKey hashKey + * @param value value + */ + public static void put(String key, Object hashKey, Object value) { + redisTemplate.opsForHash().put(key, Objects1.toString(hashKey), Objects1.toString(value)); + } + + /** + * 插入数据 json + * + * @param key key + * @param hashKey hashKey + * @param value value + */ + public static void putJson(CacheKeyDefine key, Object hashKey, Object value) { + put(key.getKey(), hashKey, JSON.toJSONString(value)); + } + + /** + * 插入数据 json + * + * @param key key + * @param hashKey hashKey + * @param value value + */ + public static void putJson(String key, Object hashKey, Object value) { + put(key, hashKey, JSON.toJSONString(value)); + } + + /** + * 插入数据 json + * + * @param key key + * @param keyMapper keyMapper + * @param value value + * @param V + */ + public static void putJson(CacheKeyDefine key, Function keyMapper, V value) { + put(key.getKey(), keyMapper.apply(value), JSON.toJSONString(value)); + } + + /** + * 插入数据 json + * + * @param key key + * @param keyMapper keyMapper + * @param value value + * @param V + */ + public static void putJson(String key, Function keyMapper, V value) { + put(key, keyMapper.apply(value), JSON.toJSONString(value)); + } + + /** + * 插入数据 + * + * @param key key + * @param values values + */ + public static void putAll(CacheKeyDefine key, Map values) { + putAll(key.getKey(), values); + } + + /** + * 插入数据 + * + * @param key key + * @param values values + */ + public static void putAll(String key, Map values) { + Map map = Maps.map(values, Objects1::toString, Objects1::toString); + redisTemplate.opsForHash().putAll(key, map); + } + + /** + * 插入数据 json + * + * @param key key + * @param values values + * @param V + */ + public static void putAllJson(CacheKeyDefine key, Map values) { + putAllJson(key.getKey(), values); + } + + /** + * 插入数据 json + * + * @param key key + * @param values values + * @param V + */ + public static void putAllJson(String key, Map values) { + Map map = Maps.map(values, Objects1::toString, JSON::toJSONString); + redisTemplate.opsForHash().putAll(key, map); + } + + /** + * 插入数据 json + * + * @param key key + * @param keyMapper keyMapper + * @param values values + * @param V + */ + public static void putAllJson(CacheKeyDefine key, Function keyMapper, List values) { + putAllJson(key.getKey(), keyMapper, values); + } + + /** + * 插入数据 json + * + * @param key key + * @param keyMapper keyMapper + * @param values values + * @param V + */ + public static void putAllJson(String key, Function keyMapper, List values) { + Map map = values.stream() + .collect(Collectors.toMap(keyMapper, JSON::toJSONString, Functions.right())); + redisTemplate.opsForHash().putAll(key, map); + } + + /** + * 获取值 + * + * @param key key + * @param hashKey hashKey + * @return value + */ + public static String get(CacheKeyDefine key, Object hashKey) { + return get(key.getKey(), hashKey); + } + + /** + * 获取值 + * + * @param key key + * @param hashKey hashKey + * @return value + */ + public static String get(String key, Object hashKey) { + Object value = redisTemplate.opsForHash().get(key, Objects1.toString(hashKey)); + if (value == null) { + return null; + } + return value.toString(); + } + + /** + * 获取值 json + * + * @param key key + * @param hashKey hashKey + * @param V + * @return value + */ + public static V getJson(CacheKeyDefine key, Object hashKey) { + return getJson(key.getKey(), hashKey, (Class) key.getType()); + } + + /** + * 获取值 json + * + * @param key key + * @param hashKey hashKey + * @param clazz clazz + * @param V + * @return value + */ + public static V getJson(String key, Object hashKey, Class clazz) { + Object value = redisTemplate.opsForHash().get(key, Objects1.toString(hashKey)); + if (value == null) { + return null; + } + return JSON.parseObject(Objects1.toString(value), clazz); + } + + /** + * 获取值 + * + * @param key key + * @param hashKeys hashKeys + * @return values + */ + public static List multiGet(CacheKeyDefine key, List hashKeys) { + return multiGet(key.getKey(), hashKeys); + } + + /** + * 获取值 + * + * @param key key + * @param hashKeys hashKeys + * @return values + */ + public static List multiGet(String key, List hashKeys) { + HashOperations op = redisTemplate.opsForHash(); + return op.multiGet(key, Lists.map(hashKeys, Objects1::toString)); + } + + /** + * 获取值 json + * + * @param key key + * @param hashKeys hashKeys + * @param keyMapper keyMapper + * @param K + * @param V + * @return values + */ + public static List multiGetJson(CacheKeyDefine key, List hashKeys) { + return multiGetJson(key.getKey(), hashKeys, (Class) key.getType()); + } + + /** + * 获取值 json + * + * @param key key + * @param hashKeys hashKeys + * @param keyMapper keyMapper + * @param clazz clazz + * @param K + * @param V + * @return values + */ + public static List multiGetJson(String key, List hashKeys, Class clazz) { + HashOperations op = redisTemplate.opsForHash(); + List multiKeys = hashKeys.stream() + .map(Objects1::toString) + .collect(Collectors.toList()); + return op.multiGet(key, multiKeys) + .stream() + .map(s -> JSON.parseObject(s, clazz)) + .collect(Collectors.toList()); + } + + /** + * 获取所有 key + * + * @param key key + * @return keys + */ + public static List keys(CacheKeyDefine key) { + return keys(key.getKey(), Function.identity()); + } + + /** + * 获取所有 key + * + * @param key key + * @return keys + */ + public static List keys(String key) { + return keys(key, Function.identity()); + } + + /** + * 获取所有 key + * + * @param key key + * @param keyMapper keyMapper + * @param K + * @return keys + */ + public static List keys(CacheKeyDefine key, Function keyMapper) { + return keys(key.getKey(), keyMapper); + } + + /** + * 获取所有 key + * + * @param key key + * @param keyMapper keyMapper + * @param K + * @return keys + */ + public static List keys(String key, Function keyMapper) { + HashOperations op = redisTemplate.opsForHash(); + return op.keys(key) + .stream() + .map(keyMapper) + .collect(Collectors.toList()); + } + + /** + * 删除 + * + * @param key key + * @param hashKey hashKey + */ + public static void delete(CacheKeyDefine key, Object hashKey) { + delete(key.getKey(), hashKey); + } + + /** + * 删除 + * + * @param key key + * @param hashKey hashKey + */ + public static void delete(String key, Object hashKey) { + redisTemplate.opsForHash().delete(key, Objects1.toString(hashKey)); + } + + /** + * 删除 + * + * @param key key + * @param hashKeys hashKeys + */ + public static void delete(CacheKeyDefine key, List hashKeys) { + delete(key.getKey(), hashKeys); + } + + /** + * 删除 + * + * @param key key + * @param hashKeys hashKeys + */ + public static void delete(String key, List hashKeys) { + Object[] deleteKeys = hashKeys.stream() + .map(Objects1::toString) + .toArray(Object[]::new); + redisTemplate.opsForHash().delete(key, deleteKeys); + } + + /** + * 获取数量 + * + * @param key key + * @return size + */ + public static Long size(CacheKeyDefine key) { + return size(key.getKey()); + } + + /** + * 获取数量 + * + * @param key key + * @return size + */ + public static Long size(String key) { + return redisTemplate.opsForHash().size(key); + } + + /** + * 获取所有键值对 + * + * @param key key + * @return entity + */ + public static Map entities(CacheKeyDefine key) { + return entities(key.getKey()); + } + + /** + * 获取所有键值对 + * + * @param key key + * @return entity + */ + public static Map entities(String key) { + HashOperations op = redisTemplate.opsForHash(); + return op.entries(key); + } + + /** + * 获取所有键值对 json + * + * @param key key + * @param V + * @return entity + */ + public static Map entitiesJson(CacheKeyDefine key) { + return entitiesJson(key.getKey(), Function.identity(), (Class) key.getType()); + } + + /** + * 获取所有键值对 json + * + * @param key key + * @param clazz clazz + * @param V + * @return entity + */ + public static Map entitiesJson(String key, Class clazz) { + return entitiesJson(key, Function.identity(), clazz); + } + + /** + * 获取所有键值对 json + * + * @param key key + * @param keyMapper keyMapper + * @param K + * @param V + * @return entity + */ + public static Map entitiesJson(CacheKeyDefine key, Function keyMapper) { + return entitiesJson(key.getKey(), keyMapper, (Class) key.getType()); + } + + /** + * 获取所有键值对 json + * + * @param key key + * @param keyMapper keyMapper + * @param clazz clazz + * @param K + * @param V + * @return entity + */ + public static Map entitiesJson(String key, Function keyMapper, Class clazz) { + Map entities = entities(key); + return Maps.map(entities, keyMapper, v -> (V) JSON.parseObject(v, clazz)); + } + + /** + * 获取所有值 + * + * @param key key + * @return values + */ + public static List values(CacheKeyDefine key) { + return values(key.getKey()); + } + + /** + * 获取所有值 + * + * @param key key + * @return values + */ + public static List values(String key) { + HashOperations op = redisTemplate.opsForHash(); + return op.values(key); + } + + /** + * 获取所有值 json + * + * @param key key + * @param V + * @return values + */ + public static List valuesJson(CacheKeyDefine key) { + return valuesJson(key.getKey(), (Class) key.getType()); + } + + /** + * 获取所有值 json + * + * @param key key + * @param V + * @return values + */ + public static List valuesJson(String key, Class clazz) { + return values(key).stream() + .map(s -> JSON.parseObject(s, clazz)) + .collect(Collectors.toList()); + } + +} diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-redis/src/main/java/com/orion/ops/framework/redis/core/utils/RedisUtils.java b/orion-ops-framework/orion-ops-spring-boot-starter-redis/src/main/java/com/orion/ops/framework/redis/core/utils/RedisUtils.java index 55a40a2d..ecb8d003 100644 --- a/orion-ops-framework/orion-ops-spring-boot-starter-redis/src/main/java/com/orion/ops/framework/redis/core/utils/RedisUtils.java +++ b/orion-ops-framework/orion-ops-spring-boot-starter-redis/src/main/java/com/orion/ops/framework/redis/core/utils/RedisUtils.java @@ -8,6 +8,7 @@ import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.ScanOptions; import java.util.HashSet; +import java.util.List; import java.util.Set; /** @@ -54,6 +55,33 @@ public class RedisUtils { }); } + /** + * 删除 key + * + * @param define define + */ + public static void delete(CacheKeyDefine define) { + delete(define.getKey()); + } + + /** + * 删除 key + * + * @param key key + */ + public static void delete(String key) { + redisTemplate.delete(key); + } + + /** + * 删除 key + * + * @param keys keys + */ + public static void delete(List keys) { + redisTemplate.delete(keys); + } + /** * 设置过期时间 * diff --git a/orion-ops-launch/src/main/resources/templates/orion-server-module-service-impl.java.vm b/orion-ops-launch/src/main/resources/templates/orion-server-module-service-impl.java.vm index d1ef9cd6..93a0c46b 100644 --- a/orion-ops-launch/src/main/resources/templates/orion-server-module-service-impl.java.vm +++ b/orion-ops-launch/src/main/resources/templates/orion-server-module-service-impl.java.vm @@ -48,13 +48,14 @@ public class ${table.serviceImplName} implements ${table.serviceName} { this.check${type}Present(record); // 插入 int effect = ${typeLower}DAO.insert(record); - log.info("${type}Service-create${type} effect: {}", effect); - return record.getId(); + Long id = record.getId(); + log.info("${type}Service-create${type} id: {}, effect: {}", id, effect); + return id; } @Override public Integer update${type}ById(${type}UpdateRequest request) { - log.info("${type}Service-update${type}ById request: {}", JSON.toJSONString(request)); + log.info("${type}Service-update${type}ById id: {}, request: {}", request.getId(), JSON.toJSONString(request)); // 查询 Long id = Valid.notNull(request.getId(), ErrorMessage.ID_MISSING); ${type}DO record = ${typeLower}DAO.selectById(id); diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/define/HostCacheKeyDefine.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/define/HostCacheKeyDefine.java index 190cac81..560da718 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/define/HostCacheKeyDefine.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/define/HostCacheKeyDefine.java @@ -20,14 +20,14 @@ public interface HostCacheKeyDefine { .key("host:key:list") .desc("主机秘钥列表") .type(HostKeyCacheDTO.class) - .timeout(3, TimeUnit.DAYS) + .timeout(1, TimeUnit.HOURS) .build(); CacheKeyDefine HOST_IDENTITY = new CacheKeyBuilder() .key("host:identity:list") .desc("主机身份列表") .type(HostIdentityCacheDTO.class) - .timeout(3, TimeUnit.DAYS) + .timeout(1, TimeUnit.HOURS) .build(); } diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/dto/HostIdentityCacheDTO.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/dto/HostIdentityCacheDTO.java index d1073937..eaf15ef1 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/dto/HostIdentityCacheDTO.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/entity/dto/HostIdentityCacheDTO.java @@ -28,4 +28,7 @@ public class HostIdentityCacheDTO implements Serializable { @Schema(description = "名称") private String name; + @Schema(description = "用户名") + private String username; + } diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/HostIdentityServiceImpl.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/HostIdentityServiceImpl.java index d31209fd..5ccb977d 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/HostIdentityServiceImpl.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/HostIdentityServiceImpl.java @@ -9,7 +9,7 @@ import com.orion.ops.framework.common.constant.Const; import com.orion.ops.framework.common.constant.ErrorMessage; import com.orion.ops.framework.common.security.PasswordModifier; import com.orion.ops.framework.common.utils.Valid; -import com.orion.ops.framework.redis.core.utils.RedisLists; +import com.orion.ops.framework.redis.core.utils.RedisMaps; import com.orion.ops.module.asset.convert.HostIdentityConvert; import com.orion.ops.module.asset.dao.HostIdentityDAO; import com.orion.ops.module.asset.dao.HostKeyDAO; @@ -60,11 +60,9 @@ public class HostIdentityServiceImpl implements HostIdentityService { // 插入 int effect = hostIdentityDAO.insert(record); log.info("HostIdentityService-createHostIdentity effect: {}", effect); - Long id = record.getId(); - // 设置缓存 - RedisLists.pushJson(HostCacheKeyDefine.HOST_IDENTITY.getKey(), HostIdentityConvert.MAPPER.toCache(record)); - RedisLists.setExpire(HostCacheKeyDefine.HOST_IDENTITY); - return id; + // 删除缓存 + RedisMaps.delete(HostCacheKeyDefine.HOST_IDENTITY); + return record.getId(); } @Override @@ -88,12 +86,12 @@ public class HostIdentityServiceImpl implements HostIdentityService { .set(HostIdentityDO::getKeyId, request.getKeyId()) .eq(HostIdentityDO::getId, id); int effect = hostIdentityDAO.update(updateRecord, wrapper); - // 设置缓存 - if (!record.getName().equals(updateRecord.getName())) { - RedisLists.removeJson(HostCacheKeyDefine.HOST_IDENTITY.getKey(), HostIdentityConvert.MAPPER.toCache(record)); - RedisLists.pushJson(HostCacheKeyDefine.HOST_IDENTITY.getKey(), HostIdentityConvert.MAPPER.toCache(updateRecord)); - } log.info("HostIdentityService-updateHostIdentityById effect: {}", effect); + // 删除缓存 + if (!record.getName().equals(updateRecord.getName()) || + !record.getUsername().equals(updateRecord.getUsername())) { + RedisMaps.delete(HostCacheKeyDefine.HOST_IDENTITY); + } return effect; } @@ -109,7 +107,7 @@ public class HostIdentityServiceImpl implements HostIdentityService { @Override public List getHostIdentityList() { // 查询缓存 - List list = RedisLists.rangeJson(HostCacheKeyDefine.HOST_IDENTITY); + List list = RedisMaps.valuesJson(HostCacheKeyDefine.HOST_IDENTITY); if (list.isEmpty()) { // 查询数据库 list = hostIdentityDAO.of().list(HostIdentityConvert.MAPPER::toCache); @@ -120,8 +118,8 @@ public class HostIdentityServiceImpl implements HostIdentityService { .build()); } // 设置缓存 - RedisLists.pushAllJson(HostCacheKeyDefine.HOST_IDENTITY.getKey(), list); - RedisLists.setExpire(HostCacheKeyDefine.HOST_IDENTITY); + RedisMaps.putAllJson(HostCacheKeyDefine.HOST_IDENTITY.getKey(), s -> s.getId().toString(), list); + RedisMaps.setExpire(HostCacheKeyDefine.HOST_IDENTITY); } // 删除默认值 return list.stream() @@ -173,7 +171,7 @@ public class HostIdentityServiceImpl implements HostIdentityService { // TODO config // 删除缓存 - RedisLists.removeJson(HostCacheKeyDefine.HOST_IDENTITY.getKey(), HostIdentityConvert.MAPPER.toCache(record)); + RedisMaps.delete(HostCacheKeyDefine.HOST_IDENTITY.getKey(), record.getId()); log.info("HostIdentityService-deleteHostIdentityById effect: {}", effect); return effect; } diff --git a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/HostKeyServiceImpl.java b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/HostKeyServiceImpl.java index 617d3308..fc713ed9 100644 --- a/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/HostKeyServiceImpl.java +++ b/orion-ops-module-asset/orion-ops-module-asset-service/src/main/java/com/orion/ops/module/asset/service/impl/HostKeyServiceImpl.java @@ -9,7 +9,7 @@ import com.orion.ops.framework.common.constant.ErrorMessage; import com.orion.ops.framework.common.security.PasswordModifier; import com.orion.ops.framework.common.utils.CryptoUtils; import com.orion.ops.framework.common.utils.Valid; -import com.orion.ops.framework.redis.core.utils.RedisLists; +import com.orion.ops.framework.redis.core.utils.RedisMaps; import com.orion.ops.module.asset.convert.HostKeyConvert; import com.orion.ops.module.asset.dao.HostIdentityDAO; import com.orion.ops.module.asset.dao.HostKeyDAO; @@ -63,9 +63,8 @@ public class HostKeyServiceImpl implements HostKeyService { int effect = hostKeyDAO.insert(record); log.info("HostKeyService-createHostKey effect: {}", effect); Long id = record.getId(); - // 设置缓存 - RedisLists.pushJson(HostCacheKeyDefine.HOST_KEY.getKey(), HostKeyConvert.MAPPER.toCache(record)); - RedisLists.setExpire(HostCacheKeyDefine.HOST_KEY); + // 删除缓存 + RedisMaps.delete(HostCacheKeyDefine.HOST_KEY); return id; } @@ -87,10 +86,9 @@ public class HostKeyServiceImpl implements HostKeyService { updateRecord.setPassword(newPassword); // 更新 int effect = hostKeyDAO.updateById(updateRecord); - // 设置缓存 + // 删除缓存 if (!record.getName().equals(updateRecord.getName())) { - RedisLists.removeJson(HostCacheKeyDefine.HOST_KEY.getKey(), HostKeyConvert.MAPPER.toCache(record)); - RedisLists.pushJson(HostCacheKeyDefine.HOST_KEY.getKey(), HostKeyConvert.MAPPER.toCache(updateRecord)); + RedisMaps.delete(HostCacheKeyDefine.HOST_KEY); } log.info("HostKeyService-updateHostKeyById effect: {}", effect); return effect; @@ -124,7 +122,7 @@ public class HostKeyServiceImpl implements HostKeyService { @Override public List getHostKeyList() { // 查询缓存 - List list = RedisLists.rangeJson(HostCacheKeyDefine.HOST_KEY); + List list = RedisMaps.valuesJson(HostCacheKeyDefine.HOST_KEY); if (list.isEmpty()) { // 查询数据库 list = hostKeyDAO.of().list(HostKeyConvert.MAPPER::toCache); @@ -135,8 +133,8 @@ public class HostKeyServiceImpl implements HostKeyService { .build()); } // 设置缓存 - RedisLists.pushAllJson(HostCacheKeyDefine.HOST_KEY.getKey(), list); - RedisLists.setExpire(HostCacheKeyDefine.HOST_KEY); + RedisMaps.putAllJson(HostCacheKeyDefine.HOST_KEY.getKey(), s -> s.getId().toString(), list); + RedisMaps.setExpire(HostCacheKeyDefine.HOST_KEY); } // 删除默认值 return list.stream() @@ -171,7 +169,7 @@ public class HostKeyServiceImpl implements HostKeyService { // TODO config // 删除缓存 - RedisLists.removeJson(HostCacheKeyDefine.HOST_KEY.getKey(), HostKeyConvert.MAPPER.toCache(record)); + RedisMaps.delete(HostCacheKeyDefine.HOST_KEY.getKey(), record.getId()); log.info("HostKeyService-deleteHostKeyById effect: {}", effect); return effect; } diff --git a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/define/FavoriteCacheKeyDefine.java b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/define/FavoriteCacheKeyDefine.java index 916bac13..e5223024 100644 --- a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/define/FavoriteCacheKeyDefine.java +++ b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/define/FavoriteCacheKeyDefine.java @@ -18,7 +18,7 @@ public interface FavoriteCacheKeyDefine { .key("favorite:{}:{}") .desc("收藏信息 ${type} ${userId}") .type(Long.class) - .timeout(3, TimeUnit.DAYS) + .timeout(8, TimeUnit.HOURS) .build(); } diff --git a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/define/TagCacheKeyDefine.java b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/define/TagCacheKeyDefine.java index 53fe8088..6cc99625 100644 --- a/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/define/TagCacheKeyDefine.java +++ b/orion-ops-module-infra/orion-ops-module-infra-service/src/main/java/com/orion/ops/module/infra/define/TagCacheKeyDefine.java @@ -19,14 +19,14 @@ public interface TagCacheKeyDefine { .key("tag:name:{}") .desc("tag 名称 ${type}") .type(TagCacheDTO.class) - .timeout(3, TimeUnit.DAYS) + .timeout(8, TimeUnit.HOURS) .build(); CacheKeyDefine TAG_REL = new CacheKeyBuilder() .key("tag:rel:{}:{}") .desc("tag 引用 ${type} ${relId}") .type(TagCacheDTO.class) - .timeout(3, TimeUnit.DAYS) + .timeout(8, TimeUnit.HOURS) .build(); }