Class BoundedCacheFactory

java.lang.Object
io.apicurio.registry.serde.utils.BoundedCacheFactory

public final class BoundedCacheFactory extends Object
Factory for creating bounded LRU (Least Recently Used) caches. These caches are thread-safe and automatically evict the least recently accessed entry when the cache exceeds the specified maximum size.
  • Method Details

    • createLRU

      public static <K, V> Map<K,V> createLRU(int maxSize)
      Creates a thread-safe bounded LRU cache. When the cache exceeds maxSize, the least recently accessed entry is removed.
      Type Parameters:
      K - the type of keys maintained by this cache
      V - the type of mapped values
      Parameters:
      maxSize - the maximum number of entries the cache should hold
      Returns:
      a new thread-safe bounded LRU cache