Class DefaultCacheManagerBuilder

java.lang.Object
com.okta.sdk.impl.cache.DefaultCacheManagerBuilder
All Implemented Interfaces:
CacheManagerBuilder

public class DefaultCacheManagerBuilder extends Object implements CacheManagerBuilder
Since:
0.5.0
  • Constructor Details

    • DefaultCacheManagerBuilder

      public DefaultCacheManagerBuilder()
  • Method Details

    • withDefaultTimeToLive

      public CacheManagerBuilder withDefaultTimeToLive(long ttl, TimeUnit timeUnit)
      Description copied from interface: CacheManagerBuilder
      Sets the default Time to Live (TTL) for all cache regions managed by the built CacheManager. You may override this default for individual cache regions by using the withCache for each region you wish to configure.

      Time to Live is the amount of time a cache entry may exist after first being created before it will expire and no longer be available. If a cache entry ever becomes older than this amount of time (regardless of how often it is accessed), it will be removed from the cache as soon as possible.

      If this value is not configured, it is assumed that cache entries could potentially live indefinitely. Note however that entries can still be expunged due to other conditions (e.g. memory constraints, Time to Idle setting, etc). Usage

           ...withDefaultTimeToLive(30, TimeUnit.MINUTES)...
           ...withDefaultTimeToLive(1, TimeUnit.HOURS)...
       
      Specified by:
      withDefaultTimeToLive in interface CacheManagerBuilder
      Parameters:
      ttl - default Time To Live scalar value
      timeUnit - default Time to Live unit of time
      Returns:
      the builder instance for method chaining.
    • withDefaultTimeToIdle

      public CacheManagerBuilder withDefaultTimeToIdle(long tti, TimeUnit timeUnit)
      Description copied from interface: CacheManagerBuilder
      Sets the default Time to Idle (TTI) for all cache regions managed by the built CacheManager. You may override this default for individual cache regions by using the withCache for each region you wish to configure.

      Time to Idle is the amount of time a cache entry may be idle (unused / not accessed) before it will expire and no longer be available. If a cache entry is not accessed at all after this amount of time, it will be removed from the cache as soon as possible.

      If this value is not configured, it is assumed that cache entries could potentially live indefinitely. Note however that entries can still be expunged due to other conditions (e.g. memory constraints, Time to Live setting, etc). Usage

           ...withDefaultTimeToLive(30, TimeUnit.MINUTES)...
           ...withDefaultTimeToLive(1, TimeUnit.HOURS)...
       
      Specified by:
      withDefaultTimeToIdle in interface CacheManagerBuilder
      Parameters:
      tti - default Time To Idle scalar value
      timeUnit - default Time to Idle unit of time
      Returns:
      the builder instance for method chaining.
    • withCache

      public CacheManagerBuilder withCache(CacheConfigurationBuilder builder)
      Description copied from interface: CacheManagerBuilder
      Adds configuration settings for a specific Cache region managed by the built CacheManager, like the region's Time to Live and Time to Idle.
      Specified by:
      withCache in interface CacheManagerBuilder
      Parameters:
      builder - the CacheConfigurationBuilder instance that will be used to a cache's configuration.
      Returns:
      this instance for method chaining.
    • build

      public CacheManager build()
      Description copied from interface: CacheManagerBuilder
      Returns a new CacheManager instance reflecting Builder's current configuration.
      Specified by:
      build in interface CacheManagerBuilder
      Returns:
      a new CacheManager instance reflecting Builder's current configuration.