Class ConcurrentHashMapProducerCacheProvider

java.lang.Object
org.apache.pulsar.reactive.client.internal.adapter.ConcurrentHashMapProducerCacheProvider
All Implemented Interfaces:
AutoCloseable, ProducerCacheProvider

public class ConcurrentHashMapProducerCacheProvider extends Object implements ProducerCacheProvider
Producer cache provider that uses a ConcurrentHashMap to cache entries.
  • 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: ProducerCacheProvider
      Gets or create an entry in the cache.
      Specified by:
      getOrCreateCachedEntry in interface ProducerCacheProvider
      Type Parameters:
      K - the type of the cache key
      V - the type of the cache entry value
      Parameters:
      key - the cache key
      createEntryFunction - 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:
      close in interface AutoCloseable