Class DynamicMetadataCacheBuilderSpec<IdentifierType,MetadataType>
java.lang.Object
net.shibboleth.oidc.metadata.cache.impl.BaseMetadataCacheBuilderSpec<IdentifierType,MetadataType>
net.shibboleth.oidc.metadata.cache.impl.DynamicMetadataCacheBuilderSpec<IdentifierType,MetadataType>
- Type Parameters:
IdentifierType- The metadata identifier type.MetadataType- the metadata type.
- All Implemented Interfaces:
MetadataCacheBuilderSpec<IdentifierType,MetadataType>
public class DynamicMetadataCacheBuilderSpec<IdentifierType,MetadataType>
extends BaseMetadataCacheBuilderSpec<IdentifierType,MetadataType>
implements MetadataCacheBuilderSpec<IdentifierType,MetadataType>
A specification for building a dynamic read-through metadata cache.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DurationThe interval at which the cleanup task should run.private Function<CriteriaSet,MetadataType> The function to use to fetch metadata if either none exists, or the existing is stale.private DurationThe initial cleanup task delay.private DurationMaximum cache duration.private DurationThe maximum idle time for which the cache will keep data for before it is removed.private Function<ExpirationTimeContext<MetadataType>,Instant> Strategy used to compute an expiration time.private DurationMinimum cache duration.private booleanFlag indicating whether idle entity data should be removed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected DurationGet the interval at which the cleanup task should run.protected Function<CriteriaSet,MetadataType> Get the metadata fetching strategy.protected DurationGet the initial cleanup task delay.protected DurationGet the maximum cache duration for metadata.protected DurationGet the maximum idle time for which the resolver will keep data for before it is removed.protected Function<ExpirationTimeContext<MetadataType>,Instant> Get the metadata expiration time strategy.protected DurationGet the minimum cache duration for metadata.protected booleanShould idle metadata be removed?voidsetCleanupTaskInterval(Duration interval) Set the interval at which the cleanup task should run.voidsetFetchStrategy(Function<CriteriaSet, MetadataType> strategy) Set the metadata fetching strategy.voidSet the initial cleanup task delay.voidsetMaxCacheDuration(Duration duration) Set the maximum cache duration for metadata.voidSet the maximum idle time for which the resolver will keep data for before it is removed.voidSet the metadata expiration time strategy.voidsetMinCacheDuration(Duration duration) Set the minimum cache duration for metadata.voidsetRemoveIdleEntityData(boolean flag) Set the flag indicating whether idle entity data should be removed.Methods inherited from class net.shibboleth.oidc.metadata.cache.impl.BaseMetadataCacheBuilderSpec
getCacheId, getCriteriaToIdentifierStrategy, getIdentifierExtractionStrategy, getMetadataBeforeRemovalHook, getMetadataFilterStrategy, getMetadataValidPredicate, getRefreshDelayFactor, setCacheId, setCriteriaToIdentifierStrategy, setIdentifierExtractionStrategy, setMetadataBeforeRemovalHook, setMetadataFilterStrategy, setMetadataValidPredicate, setRefreshDelayFactor
-
Field Details
-
fetchStrategy
The function to use to fetch metadata if either none exists, or the existing is stale. -
maxCacheDuration
Maximum cache duration. -
minCacheDuration
Minimum cache duration. -
maxIdleEntityData
The maximum idle time for which the cache will keep data for before it is removed. -
cleanupTaskInterval
The interval at which the cleanup task should run. -
removeIdleEntityData
private boolean removeIdleEntityDataFlag indicating whether idle entity data should be removed. -
initialCleanupTaskDelay
The initial cleanup task delay. -
metadataExpirationTimeStrategy
@Nullable private Function<ExpirationTimeContext<MetadataType>,Instant> metadataExpirationTimeStrategyStrategy used to compute an expiration time.
-
-
Constructor Details
-
DynamicMetadataCacheBuilderSpec
protected DynamicMetadataCacheBuilderSpec()Constructor.
-
-
Method Details
-
getMaxCacheDuration
Get the maximum cache duration for metadata.Defaults to: 8 hours.
- Returns:
- the maximum cache duration
-
setMaxCacheDuration
Set the maximum cache duration for metadata.Defaults to: 8 hours.
- Parameters:
duration- the maximum cache duration
-
getMinCacheDuration
Get the minimum cache duration for metadata.Defaults to: 10 minutes.
- Returns:
- the minimum cache duration
-
setMinCacheDuration
Set the minimum cache duration for metadata.Defaults to: 10 minutes.
- Parameters:
duration- the minimum cache duration
-
setRemoveIdleEntityData
public void setRemoveIdleEntityData(boolean flag) Set the flag indicating whether idle entity data should be removed.- Parameters:
flag- true if idle entity data should be removed, false otherwise
-
isRemoveIdleEntityData
protected boolean isRemoveIdleEntityData()Should idle metadata be removed?- Returns:
- if idle metadata should be resolved.
-
setMetadataExpirationTimeStrategy
public void setMetadataExpirationTimeStrategy(@Nonnull Function<ExpirationTimeContext<MetadataType>, Instant> strategy) Set the metadata expiration time strategy.- Parameters:
strategy- the strategy.
-
getMetadataExpirationTimeStrategy
@Nullable protected Function<ExpirationTimeContext<MetadataType>,Instant> getMetadataExpirationTimeStrategy()Get the metadata expiration time strategy.- Returns:
- the strategy.
-
getCleanupTaskInterval
Get the interval at which the cleanup task should run.Defaults to: 30 minutes.
- Returns:
- return the interval
-
setCleanupTaskInterval
Set the interval at which the cleanup task should run.Defaults to: 30 minutes.
- Parameters:
interval- the interval to set
-
setFetchStrategy
Set the metadata fetching strategy.- Parameters:
strategy- the strategy to use.
-
getFetchStrategy
Get the metadata fetching strategy.- Returns:
- the fetching strategy.
-
getMaxIdleEntityData
Get the maximum idle time for which the resolver will keep data for before it is removed.Defaults to: 8 hours.
- Returns:
- return the maximum idle time
-
setMaxIdleEntityData
Set the maximum idle time for which the resolver will keep data for before it is removed.Defaults to: 8 hours.
- Parameters:
max- the maximum entity data idle time
-
getInitialCleanupTaskDelay
Get the initial cleanup task delay.- Returns:
- Returns the initialCleanupTaskDelay.
-
setInitialCleanupTaskDelay
Set the initial cleanup task delay.- Parameters:
delay- The initialCleanupTaskDelay to set.
-