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
Fields Modifier and Type Field Description private DurationcleanupTaskIntervalThe interval at which the cleanup task should run.private Function<CriteriaSet,MetadataType>fetchStrategyThe function to use to fetch metadata if either none exists, or the existing is stale.private DurationinitialCleanupTaskDelayThe initial cleanup task delay.private DurationmaxCacheDurationMaximum cache duration.private DurationmaxIdleEntityDataThe maximum idle time for which the cache will keep data for before it is removed.private Function<ExpirationTimeContext<MetadataType>,Instant>metadataExpirationTimeStrategyStrategy used to compute an expiration time.private DurationminCacheDurationMinimum cache duration.private booleanremoveIdleEntityDataFlag indicating whether idle entity data should be removed.
-
Constructor Summary
Constructors Modifier Constructor Description protectedDynamicMetadataCacheBuilderSpec()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DurationgetCleanupTaskInterval()Get the interval at which the cleanup task should run.protected Function<CriteriaSet,MetadataType>getFetchStrategy()Get the metadata fetching strategy.protected DurationgetInitialCleanupTaskDelay()Get the initial cleanup task delay.protected DurationgetMaxCacheDuration()Get the maximum cache duration for metadata.protected DurationgetMaxIdleEntityData()Get the maximum idle time for which the resolver will keep data for before it is removed.protected Function<ExpirationTimeContext<MetadataType>,Instant>getMetadataExpirationTimeStrategy()Get the metadata expiration time strategy.protected DurationgetMinCacheDuration()Get the minimum cache duration for metadata.protected booleanisRemoveIdleEntityData()Should 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.voidsetInitialCleanupTaskDelay(Duration delay)Set the initial cleanup task delay.voidsetMaxCacheDuration(Duration duration)Set the maximum cache duration for metadata.voidsetMaxIdleEntityData(Duration max)Set the maximum idle time for which the resolver will keep data for before it is removed.voidsetMetadataExpirationTimeStrategy(Function<ExpirationTimeContext<MetadataType>,Instant> strategy)Set 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 Detail
-
fetchStrategy
@Nullable private Function<CriteriaSet,MetadataType> fetchStrategy
The function to use to fetch metadata if either none exists, or the existing is stale.
-
maxCacheDuration
@Nonnull private Duration maxCacheDuration
Maximum cache duration.
-
minCacheDuration
@Nonnull private Duration minCacheDuration
Minimum cache duration.
-
maxIdleEntityData
@Nullable private Duration maxIdleEntityData
The maximum idle time for which the cache will keep data for before it is removed.
-
cleanupTaskInterval
@Nonnull private Duration cleanupTaskInterval
The interval at which the cleanup task should run.
-
removeIdleEntityData
private boolean removeIdleEntityData
Flag indicating whether idle entity data should be removed.
-
initialCleanupTaskDelay
@Nonnull private Duration initialCleanupTaskDelay
The initial cleanup task delay.
-
metadataExpirationTimeStrategy
@Nullable private Function<ExpirationTimeContext<MetadataType>,Instant> metadataExpirationTimeStrategy
Strategy used to compute an expiration time.
-
-
Method Detail
-
getMaxCacheDuration
@Nonnull protected Duration getMaxCacheDuration()
Get the maximum cache duration for metadata.Defaults to: 8 hours.
- Returns:
- the maximum cache duration
-
setMaxCacheDuration
public void setMaxCacheDuration(@Nonnull Duration duration)Set the maximum cache duration for metadata.Defaults to: 8 hours.
- Parameters:
duration- the maximum cache duration
-
getMinCacheDuration
@Nonnull protected Duration getMinCacheDuration()
Get the minimum cache duration for metadata.Defaults to: 10 minutes.
- Returns:
- the minimum cache duration
-
setMinCacheDuration
public void setMinCacheDuration(@Nonnull Duration duration)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
@Nonnull protected Duration getCleanupTaskInterval()
Get the interval at which the cleanup task should run.Defaults to: 30 minutes.
- Returns:
- return the interval
-
setCleanupTaskInterval
public void setCleanupTaskInterval(@Nonnull Duration interval)Set the interval at which the cleanup task should run.Defaults to: 30 minutes.
- Parameters:
interval- the interval to set
-
setFetchStrategy
public void setFetchStrategy(@Nonnull Function<CriteriaSet,MetadataType> strategy)Set the metadata fetching strategy.- Parameters:
strategy- the strategy to use.
-
getFetchStrategy
@Nullable protected Function<CriteriaSet,MetadataType> getFetchStrategy()
Get the metadata fetching strategy.- Returns:
- the fetching strategy.
-
getMaxIdleEntityData
@Nonnull protected Duration 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
public void setMaxIdleEntityData(@Nonnull Duration max)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
@Nonnull protected Duration getInitialCleanupTaskDelay()
Get the initial cleanup task delay.- Returns:
- Returns the initialCleanupTaskDelay.
-
setInitialCleanupTaskDelay
public void setInitialCleanupTaskDelay(@Nonnull Duration delay)Set the initial cleanup task delay.- Parameters:
delay- The initialCleanupTaskDelay to set.
-
-