Class ConcurrentHashMapProducerCacheProvider
java.lang.Object
org.apache.pulsar.reactive.client.internal.adapter.ConcurrentHashMapProducerCacheProvider
- All Implemented Interfaces:
AutoCloseable,ProducerCacheProvider
Producer cache provider that uses a
ConcurrentHashMap to cache entries.-
Constructor Summary
ConstructorsConstructorDescriptionConcurrentHashMapProducerCacheProvider's constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()<K,V> CompletableFuture<V> getOrCreateCachedEntry(K key, Function<K, CompletableFuture<V>> createEntryFunction) Gets or create an entry in the cache.
-
Constructor Details
-
ConcurrentHashMapProducerCacheProvider
public ConcurrentHashMapProducerCacheProvider()ConcurrentHashMapProducerCacheProvider's constructor.
-
-
Method Details
-
getOrCreateCachedEntry
public <K,V> CompletableFuture<V> getOrCreateCachedEntry(K key, Function<K, CompletableFuture<V>> createEntryFunction) Description copied from interface:ProducerCacheProviderGets or create an entry in the cache.- Specified by:
getOrCreateCachedEntryin interfaceProducerCacheProvider- Type Parameters:
K- the type of the cache keyV- the type of the cache entry value- Parameters:
key- the cache keycreateEntryFunction- a function called to create the entry in the cache if it's not present.- Returns:
- the cache entry value
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-