| | |
| | | @PostConstruct |
| | | public void init() { |
| | | // 同时初始化多组全局缓存: symbolDecimal symbolItem remarksSymbol itemList |
| | | log.info("init初始化item list"); |
| | | itemList = new ArrayList<>(list()); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 通过 symbol 找去缓存对象 |
| | | * |
| | | * @param symbol |
| | | * @return |
| | | */ |
| | | @Transactional(propagation = Propagation.NOT_SUPPORTED) |
| | | public Item findCaCheBySymbol(String symbol) { |
| | | Item item; |
| | | if (CollectionUtil.isNotEmpty(symbolItem)) { |
| | | item = symbolItem.get(symbol); |
| | | if (item != null) { |
| | | return item; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 基于 remarks 字段去缓存提取 item 对象,特性是基于 remarks 映射 symbol,从缓存中提取 item; |
| | | * 如果缓存中没有数据,则直接去数据库查询返回。 |
| | | * |