工厂模式

工厂模式

定义工厂类,及工厂方法,获取工厂里面的数据

@Service
@Order
public class RuleFactory {
    private static final Logger logger = LoggerFactory.getLogger(RuleFactory.class);
	/**
     * 本地规则缓存
     * ruleKey :rule上下文
     */
    private ConcurrentMap<String, RuleContext> ruleContextCache = new ConcurrentHashMap<>();
	
	public RuleContext getRuleContext(Rule rule, String debugIp) {
        return ruleContextCache.get(ruleKey);
    }
}	
posted @ 2022-11-11 17:43  SpecialSpeculator  阅读(15)  评论(0编辑  收藏  举报