public void removeFromCache(String processId, long processInstanceId) {
    String businessId = businessIdCache.get(processInstanceId);
    if (StringUtils.isNotBlank(businessId)) {
      processInstanceIdCache.remove(processId + "_" + businessId);
      businessIdCache.remove(processInstanceId);

      ProcessInstanceBOInfo info =
          processInstanceBOService.getProcessInstanceBOInfo(processInstanceId);
      if (info != null) {
        processInstanceBOService.removeProcessInstanceBOInfo(info);
      }
    }
  }
 public void init() {
   List<ProcessInstanceBOInfo> infoes =
       processInstanceBOService.getAllNormalProcessInstanceBOInfo();
   if (infoes != null && infoes.size() > 0) {
     for (ProcessInstanceBOInfo info : infoes) {
       put(info.getProcessId(), info.getBusinessId(), info.getProcessInstanceId());
     }
   }
 }
  public void putAndSave(String processId, String businessId, Long processInstanceId) {
    ProcessInstanceBOInfo info = new ProcessInstanceBOInfo();
    info.setBusinessId(businessId);
    info.setProcessId(processId);
    info.setProcessInstanceId(processInstanceId);
    info.setCreateTime(new Date());
    info.setStatus(String.valueOf(ProcessInstanceBOInfo.Status.NORMAL.ordinal()));

    processInstanceBOService.createProcessInstanceBOInfo(info);
    put(processId, businessId, processInstanceId);
  }
 public String getBusinessId(Long processInstanceId) {
   String businessId = businessIdCache.get(processInstanceId);
   if (businessId == null) {
     synchronized (ProcessInstanceBOCache.class) {
       if (businessId == null) {
         logger.info("fetch from database");
         ProcessInstanceBOInfo info =
             processInstanceBOService.getProcessInstanceBOInfo(processInstanceId);
         businessId = info != null ? info.getBusinessId() : null;
         if (businessId != null) {
           put(info.getProcessId(), businessId, processInstanceId);
         }
       }
     }
   }
   return businessId;
 }
 public Long getProcessInstanceId(String processId, String businessId) {
   Long value = processInstanceIdCache.get(processId + "_" + businessId);
   if (value == null) {
     synchronized (ProcessInstanceBOCache.class) {
       if (value == null) {
         logger.info("fetch from database");
         ProcessInstanceBOInfo info =
             processInstanceBOService.getProcessInstanceBOInfo(processId, businessId);
         value = info != null ? info.getProcessInstanceId() : null;
         if (value != null) {
           put(processId, businessId, value);
         }
       }
     }
   }
   return value;
 }