工厂模式
定义工厂类,及工厂方法,获取工厂里面的数据
@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);
}
}
标签:ruleContextCache,private,工厂,ruleKey,模式,RuleFactory,class
From: https://www.cnblogs.com/PythonOrg/p/16881288.html