@Override
    public int cleanUpOneFileCache(
        FileCache<ConcurrentSkipListMap<Long, LlapDataBuffer>> fc,
        int leftToCheck, long endTime, Ref<Boolean> isPastEndTime)
        throws InterruptedException {
      // Iterate thru the file cache. This is best-effort.
      Iterator<Map.Entry<Long, LlapDataBuffer>> subIter = fc.getCache().entrySet().iterator();
      while (subIter.hasNext()) {
        long time = -1;
        isPastEndTime.value = isPastEndTime.value || ((time = System.nanoTime()) >= endTime);
        Thread.sleep(((leftToCheck <= 0) || isPastEndTime.value)
            ? 1 : (endTime - time) / (1000000L * leftToCheck));
        if (subIter.next().getValue().isInvalid()) {
          subIter.remove();
        }
        --leftToCheck;
      }
      return leftToCheck;
    }
Adds cached buffer to buffer list.
@param currentNotCached Pointer to the list node where we are inserting.
@param currentCached The cached buffer found for this node, to insert.
@return The new currentNotCached pointer, following the cached buffer insertion.
llap-server/src/java/org/apache/hadoop/hive/llap/cache/LowLevelCacheImpl.java