Class TokenCacheConfiguration
java.lang.Object
com.sap.cloud.security.xsuaa.tokenflows.TokenCacheConfiguration
- All Implemented Interfaces:
CacheConfiguration
Data class to capture configuration options of token caches.
-
Method Summary
Modifier and TypeMethodDescriptionstatic TokenCacheConfigurationThe default cache configuration.static TokenCacheConfigurationA special cache configuration used to disable caching.booleanintstatic TokenCacheConfigurationgetInstance(Duration cacheDuration, int cacheSize, Duration tokenExpirationDelta) Creates a newTokenCacheConfigurationinstance with the given properties.static TokenCacheConfigurationgetInstance(Duration cacheDuration, int cacheSize, Duration tokenExpirationDelta, boolean cacheStatisticsEnabled) Creates a newTokenCacheConfigurationinstance with the given properties.If a cached token expires because its expiration time (exp) has been reached, it should not be retrieved from the cache.inthashCode()booleantoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.sap.cloud.security.config.CacheConfiguration
isCacheDisabled
-
Method Details
-
getInstance
public static TokenCacheConfiguration getInstance(@Nonnull Duration cacheDuration, int cacheSize, @Nonnull Duration tokenExpirationDelta) Creates a newTokenCacheConfigurationinstance with the given properties. SeeCacheConfiguration.getCacheDuration(),CacheConfiguration.getCacheSize()andgetTokenExpirationDelta()for an explanation of the respective properties.- Parameters:
cacheDuration- the cache duration property.cacheSize- the cache size property.tokenExpirationDelta- the token expiration delta.- Returns:
- a new
TokenCacheConfigurationinstance.
-
getInstance
public static TokenCacheConfiguration getInstance(Duration cacheDuration, int cacheSize, Duration tokenExpirationDelta, boolean cacheStatisticsEnabled) Creates a newTokenCacheConfigurationinstance with the given properties. SeeCacheConfiguration.getCacheDuration(),CacheConfiguration.getCacheSize(),getTokenExpirationDelta()andCacheConfiguration.isCacheStatisticsEnabled()for an explanation of the respective properties.- Parameters:
cacheDuration- the cache duration property.cacheSize- the cache size property.tokenExpirationDelta- the token expiration delta.cacheStatisticsEnabled-trueif cache statistic recording has been enabled- Returns:
- a new
TokenCacheConfigurationinstance.
-
cacheDisabled
The default cache configuration. -
defaultConfiguration
A special cache configuration used to disable caching. -
getCacheDuration
- Specified by:
getCacheDurationin interfaceCacheConfiguration
-
getCacheSize
public int getCacheSize()- Specified by:
getCacheSizein interfaceCacheConfiguration
-
getTokenExpirationDelta
If a cached token expires because its expiration time (exp) has been reached, it should not be retrieved from the cache. A new token should be requested in this case. For this to work cached tokens are being checked if their expiration time (exp) has already been reached or if it is soon going to be reached. The expiration delta controls what soon means. For example if the expiration delta is set to 10 seconds and a cached token will expire in 5 seconds, it will not be retrieved from cache anymore because the duration until the token is expired is smaller than delta.- Returns:
- the token expiration delta.
-
isCacheStatisticsEnabled
public boolean isCacheStatisticsEnabled()- Specified by:
isCacheStatisticsEnabledin interfaceCacheConfiguration
-
equals
-
hashCode
public int hashCode() -
toString
-