缓存小案例

private Map<String, IChannel> registerChannelMap = new HashMap<String, IChannel>();

if (registerChannelMap.isEmpty()) {
      List<IChannel> channelList = messageStore.getRegisteredChannels();
       for (IChannel c : channelList) {
              registerChannelMap.put(c.getId() + "", c);
       }
}

原文地址:https://www.cnblogs.com/lingl/p/10250115.html