Package io.apicurio.registry.resolver
Class ERCache<V>
java.lang.Object
io.apicurio.registry.resolver.ERCache<V>
Expiration + Retry Cache
- Author:
- Jakub Senko
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclear()voidconfigureArtifactCoordinatesKeyExtractor(Function<V, ArtifactCoordinates> keyExtractor) voidconfigureCacheLatest(boolean cacheLatest) Iftrue, will cache schema lookups that either have `latest` or no version specified.voidconfigureContentHashKeyExtractor(Function<V, String> keyExtractor) voidconfigureContentIdKeyExtractor(Function<V, Long> keyExtractor) voidconfigureContentKeyExtractor(Function<V, String> keyExtractor) voidconfigureFaultTolerantRefresh(boolean faultTolerantRefresh) If set totrue, will log the load error instead of throwing it when an exception occurs trying to refresh a cache entry.voidconfigureGlobalIdKeyExtractor(Function<V, Long> keyExtractor) voidconfigureLifetime(Duration lifetime) voidconfigureRetryBackoff(Duration backoff) voidconfigureRetryCount(long retries) booleanbooleanbooleancontainsByContentId(Long key) booleancontainsByGlobalId(Long key) getByArtifactCoordinates(ArtifactCoordinates key, Function<ArtifactCoordinates, V> loaderFunction) getByContent(String key, Function<String, V> loaderFunction) getByContentHash(String key, Function<String, V> loaderFunction) getByContentId(Long key, Function<Long, V> loaderFunction) getByGlobalId(Long key, Function<Long, V> loaderFunction) booleanReturn whether caching of artifact lookups withnullversions is enabled.booleanReturn whether fault tolerant refresh is enabled.
-
Constructor Details
-
ERCache
public ERCache()
-
-
Method Details
-
configureLifetime
-
configureRetryBackoff
-
configureRetryCount
public void configureRetryCount(long retries) -
configureCacheLatest
public void configureCacheLatest(boolean cacheLatest) Iftrue, 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 totrue, 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
-
configureContentKeyExtractor
-
configureContentIdKeyExtractor
-
configureArtifactCoordinatesKeyExtractor
-
configureContentHashKeyExtractor
-
isCacheLatest
public boolean isCacheLatest()Return whether caching of artifact lookups withnullversions is enabled.- Returns:
trueif it's enabled.- See Also:
-
isFaultTolerantRefresh
public boolean isFaultTolerantRefresh()Return whether fault tolerant refresh is enabled.- Returns:
trueif it's enabled.- See Also:
-
checkInitialized
public void checkInitialized() -
containsByGlobalId
-
containsByContentId
-
containsByArtifactCoordinates
-
containsByContentHash
-
getByGlobalId
-
getByContent
-
getByContentId
-
getByArtifactCoordinates
public V getByArtifactCoordinates(ArtifactCoordinates key, Function<ArtifactCoordinates, V> loaderFunction) -
getByContentHash
-
clear
public void clear()
-