Class BaseMetadataCacheBuilderSpec<IdentifierType,MetadataType>
java.lang.Object
net.shibboleth.oidc.metadata.cache.impl.BaseMetadataCacheBuilderSpec<IdentifierType,MetadataType>
- Type Parameters:
IdentifierType- the identifier type.MetadataType- the metadata type.
- Direct Known Subclasses:
BatchMetadataCacheBuilderSpec,DynamicMetadataCacheBuilderSpec,FetchThroughMetadataCacheBuilderSpec
A based metadata cache builder specification.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringAn identifier to give the cache this specification builds.private Function<CriteriaSet,IdentifierType> Map criteria to identifiers to use as keys to the backing store.private Function<MetadataType,IdentifierType> Strategy used to extract an identifier from the given metadata.private BiConsumer<List<MetadataType>,IdentifierType> A hook that is executed just before a cache entry will been removed/invalidated/evicted.A strategy to filter metadata.private Predicate<MetadataType>Is the metadata valid? Defaults to true.private FloatFactor used to compute when the next refresh interval will occur. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringGet the cache identifier.protected Function<CriteriaSet,IdentifierType> Get the criteria set to identifier lookup strategy.protected Function<MetadataType,IdentifierType> Get the identifier extraction strategy.protected BiConsumer<List<MetadataType>,IdentifierType> Get the metadata before removal hook.protected BiFunction<MetadataType,MetadataFilterContext, MetadataType> Get the metadata filter strategy.protected Predicate<MetadataType>Get the predicate which determines if a piece of metadata is valid or not.protected FloatGets the delay factor used to compute the next refresh time.voidsetCacheId(String id) Set the cache identifier of the cache this specification builds.voidSet the criteria set to identifier lookup strategy.voidSet the identifier extraction strategy.voidSet a hook to run before a metadata cache entry is removed from the cache.voidSet the metadata filtering strategy.voidsetMetadataValidPredicate(Predicate<MetadataType> predicate) Set the predicate which determines if a piece of metadata is valid or not.voidsetRefreshDelayFactor(Float factor) Sets the delay factor used to compute the next refresh time.
-
Field Details
-
refreshDelayFactor
Factor used to compute when the next refresh interval will occur. Default value: 0.75 -
identifierExtractionStrategy
Strategy used to extract an identifier from the given metadata. -
criteriaToIdentifierStrategy
Map criteria to identifiers to use as keys to the backing store. -
metadataFilterStrategy
A strategy to filter metadata. -
cacheId
An identifier to give the cache this specification builds. Used for logging. -
metadataBeforeRemovalHook
A hook that is executed just before a cache entry will been removed/invalidated/evicted. The metadata list could be null, the identifier is never null. -
metadataValidPredicate
Is the metadata valid? Defaults to true.
-
-
Constructor Details
-
BaseMetadataCacheBuilderSpec
protected BaseMetadataCacheBuilderSpec()Constructor.
-
-
Method Details
-
setMetadataValidPredicate
Set the predicate which determines if a piece of metadata is valid or not.- Parameters:
predicate- the predicate.
-
getMetadataValidPredicate
Get the predicate which determines if a piece of metadata is valid or not.- Returns:
- the predicate.
-
setCacheId
Set the cache identifier of the cache this specification builds.- Parameters:
id- the cache identifier.
-
getCacheId
Get the cache identifier.- Returns:
- the cache identifier.
-
setMetadataBeforeRemovalHook
public void setMetadataBeforeRemovalHook(@Nullable BiConsumer<List<MetadataType>, IdentifierType> hook) Set a hook to run before a metadata cache entry is removed from the cache.The hook is required to gracefully handle null metadata lists.
- Parameters:
hook- the hook to run.
-
getMetadataBeforeRemovalHook
Get the metadata before removal hook. Could be null.- Returns:
- the hook.
-
setMetadataFilterStrategy
public void setMetadataFilterStrategy(@Nonnull BiFunction<MetadataType, MetadataFilterContext, MetadataType> strategy) Set the metadata filtering strategy.Defaults to a no-op strategy.
- Parameters:
strategy- the metadata filtering strategy.
-
getMetadataFilterStrategy
@Nonnull protected BiFunction<MetadataType,MetadataFilterContext, getMetadataFilterStrategy()MetadataType> Get the metadata filter strategy.- Returns:
- the metadata filtering strategy
-
setIdentifierExtractionStrategy
public void setIdentifierExtractionStrategy(@Nonnull Function<MetadataType, IdentifierType> strategy) Set the identifier extraction strategy.- Parameters:
strategy- the strategy to set.
-
getIdentifierExtractionStrategy
Get the identifier extraction strategy.- Returns:
- strategy the strategy.
-
setCriteriaToIdentifierStrategy
Set the criteria set to identifier lookup strategy.- Parameters:
strategy- the strategy to set.
-
getCriteriaToIdentifierStrategy
Get the criteria set to identifier lookup strategy.- Returns:
- strategy the strategy.
-
getRefreshDelayFactor
Gets the delay factor used to compute the next refresh time.Defaults to: 0.75.
- Returns:
- delay factor used to compute the next refresh time
-
setRefreshDelayFactor
Sets the delay factor used to compute the next refresh time. The delay must be between 0.0 and 1.0, exclusive.Defaults to: 0.75.
- Parameters:
factor- delay factor used to compute the next refresh time
-