Skip to content

Commit

Permalink
feat: 添加配置错误不缓存策略枚举及工厂
Browse files Browse the repository at this point in the history
  • Loading branch information
YanAnHuaZai committed May 28, 2024
1 parent 072d5cd commit 92b9d04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ public enum MistakeStrategyEnum {
/**
* 指定缓存时间
*/
SPECIFIED_CACHE_TIME
SPECIFIED_CACHE_TIME,
/**
* 不缓存
*/
UNCACHED,
;

}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit 92b9d04

Please sign in to comment.