Class ERCache<V>

java.lang.Object
io.apicurio.registry.resolver.ERCache<V>

public class ERCache<V> extends Object
Expiration + Retry Cache
Author:
Jakub Senko
  • Constructor Details

    • ERCache

      public ERCache()
  • Method Details

    • configureLifetime

      public void configureLifetime(Duration lifetime)
    • configureRetryBackoff

      public void configureRetryBackoff(Duration backoff)
    • configureRetryCount

      public void configureRetryCount(long retries)
    • configureCacheLatest

      public void configureCacheLatest(boolean cacheLatest)
      If true, will cache schema lookups that either have `latest` or no version specified. Setting this to false will effectively disable caching for schema lookups that do not specify a version.
      Parameters:
      cacheLatest - Whether to enable cache of artifacts without a version specified.
    • configureFaultTolerantRefresh

      public void configureFaultTolerantRefresh(boolean faultTolerantRefresh)
      If set to true, will log the load error instead of throwing it when an exception occurs trying to refresh a cache entry. This will still honor retries before enacting this behavior.
      Parameters:
      faultTolerantRefresh - Whether to enable fault tolerant refresh behavior.
    • configureGlobalIdKeyExtractor

      public void configureGlobalIdKeyExtractor(Function<V,Long> keyExtractor)
    • configureContentKeyExtractor

      public void configureContentKeyExtractor(Function<V,String> keyExtractor)
    • configureContentIdKeyExtractor

      public void configureContentIdKeyExtractor(Function<V,Long> keyExtractor)
    • configureArtifactCoordinatesKeyExtractor

      public void configureArtifactCoordinatesKeyExtractor(Function<V,ArtifactCoordinates> keyExtractor)
    • configureContentHashKeyExtractor

      public void configureContentHashKeyExtractor(Function<V,String> keyExtractor)
    • isCacheLatest

      public boolean isCacheLatest()
      Return whether caching of artifact lookups with null versions is enabled.
      Returns:
      true if it's enabled.
      See Also:
    • isFaultTolerantRefresh

      public boolean isFaultTolerantRefresh()
      Return whether fault tolerant refresh is enabled.
      Returns:
      true if it's enabled.
      See Also:
    • checkInitialized

      public void checkInitialized()
    • containsByGlobalId

      public boolean containsByGlobalId(Long key)
    • containsByContentId

      public boolean containsByContentId(Long key)
    • containsByArtifactCoordinates

      public boolean containsByArtifactCoordinates(ArtifactCoordinates key)
    • containsByContentHash

      public boolean containsByContentHash(String key)
    • getByGlobalId

      public V getByGlobalId(Long key, Function<Long,V> loaderFunction)
    • getByContent

      public V getByContent(String key, Function<String,V> loaderFunction)
    • getByContentId

      public V getByContentId(Long key, Function<Long,V> loaderFunction)
    • getByArtifactCoordinates

      public V getByArtifactCoordinates(ArtifactCoordinates key, Function<ArtifactCoordinates,V> loaderFunction)
    • getByContentHash

      public V getByContentHash(String key, Function<String,V> loaderFunction)
    • clear

      public void clear()