From 92b9d04e4723ce4aa1a0b597169712e0381bc3af Mon Sep 17 00:00:00 2001 From: YanAnHuaZai Date: Tue, 28 May 2024 19:48:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=B8=8D=E7=BC=93=E5=AD=98=E7=AD=96=E7=95=A5?= =?UTF-8?q?=E6=9E=9A=E4=B8=BE=E5=8F=8A=E5=B7=A5=E5=8E=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spring/cache/manager/mistake/MistakeStrategyEnum.java | 6 +++++- .../cache/manager/mistake/MistakeStrategyFactory.java | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/cn/huazai/tool/spring/cache/manager/mistake/MistakeStrategyEnum.java b/src/main/java/cn/huazai/tool/spring/cache/manager/mistake/MistakeStrategyEnum.java index e7a4a86..2cb5eee 100644 --- a/src/main/java/cn/huazai/tool/spring/cache/manager/mistake/MistakeStrategyEnum.java +++ b/src/main/java/cn/huazai/tool/spring/cache/manager/mistake/MistakeStrategyEnum.java @@ -16,7 +16,11 @@ public enum MistakeStrategyEnum { /** * 指定缓存时间 */ - SPECIFIED_CACHE_TIME + SPECIFIED_CACHE_TIME, + /** + * 不缓存 + */ + UNCACHED, ; } diff --git a/src/main/java/cn/huazai/tool/spring/cache/manager/mistake/MistakeStrategyFactory.java b/src/main/java/cn/huazai/tool/spring/cache/manager/mistake/MistakeStrategyFactory.java index 52d9acc..6c4b768 100644 --- a/src/main/java/cn/huazai/tool/spring/cache/manager/mistake/MistakeStrategyFactory.java +++ b/src/main/java/cn/huazai/tool/spring/cache/manager/mistake/MistakeStrategyFactory.java @@ -1,6 +1,7 @@ package cn.huazai.tool.spring.cache.manager.mistake; import cn.huazai.tool.spring.cache.manager.mistake.impl.MistakeThrowExceptionStrategy; +import cn.huazai.tool.spring.cache.manager.mistake.impl.MistakeUncachedStrategy; import java.util.HashMap; import java.util.Map; @@ -23,6 +24,8 @@ private MistakeStrategyFactory() {} static { // 抛出异常策略 STRATEGY_MAP.put(MistakeStrategyEnum.THROW_EXCEPTION, new MistakeThrowExceptionStrategy()); + // 不缓存策略 + STRATEGY_MAP.put(MistakeStrategyEnum.UNCACHED, new MistakeUncachedStrategy()); } public static IMistakeStrategy getStrategy(MistakeStrategyEnum strategyEnum) {