private Map<Object, LlapDaemonProtocolProtos.CacheEntry.Builder> encodeAndSortHotBuffersByFileKey(
      List<LlapCacheableBuffer> buffers) {
    Map<Object, LlapDaemonProtocolProtos.CacheEntry.Builder> lookupMap = new HashMap<>();
    for (LlapCacheableBuffer b : buffers) {
      if (b instanceof LlapDataBuffer) {
        LlapDataBuffer db = (LlapDataBuffer) b;
        try {
          Object fileKey = db.getFileKey();
          String path = pathCache.resolve(db.getFileKey());
          if (path != null) {
            LlapDaemonProtocolProtos.CacheEntry.Builder builder =
                lookupOrCreateCacheEntryFromDataBuffer(lookupMap, db, fileKey, path);
            LlapDaemonProtocolProtos.CacheEntryRange.Builder range =
                LlapDaemonProtocolProtos.CacheEntryRange.newBuilder().setStart(db.getStart())
                    .setEnd(db.getStart() + db.declaredCachedLength);
            builder.addRanges(range);
          }
        } catch (IOException ex) {
          // This should never happen. It only happens if we can't decode the fileKey.
          LOG.warn("Skip buffer from CacheEntryList.", ex);
        }
      }
    }
    return lookupMap;
  }
Internal helper class for extracting the metadata of the cache content and loading data into the cache
based on the provided metadata.
llap-server/src/java/org/apache/hadoop/hive/llap/io/api/impl/LlapCacheMetadataSerializer.java