code: public ReportRequest[] flush() {
      if (cache == null) {
        return NO_REQUESTS;
      }
  
      // Thread safety - the current thread cleans up the cache, which may add multiple cached
      // aggregated operations to the output deque.
      synchronized (cache) {
        cache.cleanUp();
        // Thread safety - the rest of the function deals with items in a ConcurrentLinkedDeque which
        // guarantees a consistent view in multi-threaded scenarios.
        ReportRequest[] res = generatedFlushRequests(out);
        out.clear();
        return res;
      }
    }
docs: Flushes this instance's cache.
  
  The instance's driver should call the this method every {@link #getFlushIntervalMillis()}
  milliseconds, and send the results to the report service.
  
  @return ReportRequest[] corresponding to the operations aggregated from calls to
  {@link #report}