public class DefaultCacheManagerBuilder extends Object implements CacheManagerBuilder
Constructor and Description |
---|
DefaultCacheManagerBuilder() |
Modifier and Type | Method and Description |
---|---|
CacheManager |
build()
Returns a new
CacheManager instance reflecting Builder's current configuration. |
CacheManagerBuilder |
withCache(CacheConfigurationBuilder builder)
Adds configuration settings for a specific Cache region managed by the
built
CacheManager , like the region's Time to Live and Time to Idle. |
CacheManagerBuilder |
withDefaultTimeToIdle(long tti,
TimeUnit timeUnit)
Sets the default Time to Idle (TTI) for all cache regions managed by the
built
CacheManager . |
CacheManagerBuilder |
withDefaultTimeToLive(long ttl,
TimeUnit timeUnit)
Sets the default Time to Live (TTL) for all cache regions managed by the
built
CacheManager . |
public CacheManagerBuilder withDefaultTimeToLive(long ttl, TimeUnit timeUnit)
CacheManagerBuilder
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)...
withDefaultTimeToLive
in interface CacheManagerBuilder
ttl
- default Time To Live scalar valuetimeUnit
- default Time to Live unit of timepublic CacheManagerBuilder withDefaultTimeToIdle(long tti, TimeUnit timeUnit)
CacheManagerBuilder
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)...
withDefaultTimeToIdle
in interface CacheManagerBuilder
tti
- default Time To Idle scalar valuetimeUnit
- default Time to Idle unit of timepublic CacheManagerBuilder withCache(CacheConfigurationBuilder builder)
CacheManagerBuilder
built
CacheManager
, like the region's Time to Live and Time to Idle.withCache
in interface CacheManagerBuilder
builder
- the CacheConfigurationBuilder instance that will be used to a cache's configuration.public CacheManager build()
CacheManagerBuilder
CacheManager
instance reflecting Builder's current configuration.build
in interface CacheManagerBuilder
CacheManager
instance reflecting Builder's current configuration.Copyright © 2017–2023 Okta. All rights reserved.