private void addRequestToAuditlogCache(Request request) {
    if(!auditLogger.isEnabled()) {
      return;
    }
    if(auditlogRequestCache.getIfPresent(request.getRequestId()) == null) {
      int numberOfTasks = 0;
      for (Stage stage : request.getStages()) {
        numberOfTasks += stage.getOrderedHostRoleCommands().size();
      }
      RequestDetails requestDetails = new RequestDetails();
      requestDetails.setNumberOfTasks(numberOfTasks);
      requestDetails.setUserName(AuthorizationHelper.getAuthenticatedName());
      requestDetails.setProxyUserName(AuthorizationHelper.getProxyUserName());
      auditlogRequestCache.put(request.getRequestId(), requestDetails);
    }
  }
Adds request to auditlog cache
@param request
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java