public V get(K key) {
    BoundedMap<K, V> map = cache.get();
    if (map == null) {
      map = new BoundedMap<>(maxSizePerThread);
      cache.set(map);
    }
    V value = map.get(key);
    if (value == null) {
      value = getNewInstance(key);
      map.put(key, value);
    }
    return value;
  }
Provides a thread local cache with a maximum cache size per thread.

<p>Note: Values must not be null.

<p>Copied from flink-1.18
amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/main/java/org/apache/amoro/flink/util/ThreadLocalCache.java