io.atleon.avro.AvroSchemaCache Maven / Gradle / Ivy
package io.atleon.avro;
import org.apache.avro.Schema;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
public final class AvroSchemaCache {
private final Map cache = new ConcurrentHashMap<>();
public Schema load(K key, Function cacheLoader) {
return cache.computeIfAbsent(key, cacheLoader);
}
}