public static <K, V> ThreadLocalCache<K, V> of(Function<K, V> creator) {
    return new ThreadLocalCache<K, V>() {
      @Override
      public V getNewInstance(K key) {
        return creator.apply(key);
      }
    };
  }
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