Class DefaultCacheManagerBuilder
- All Implemented Interfaces:
CacheManagerBuilder
- Since:
- 0.5.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns a newCacheManager
instance reflecting Builder's current configuration.withCache
(CacheConfigurationBuilder builder) Adds configuration settings for a specific Cache region managed by thebuilt
CacheManager
, like the region's Time to Live and Time to Idle.withDefaultTimeToIdle
(long tti, TimeUnit timeUnit) Sets the default Time to Idle (TTI) for all cache regions managed by thebuilt
CacheManager
.withDefaultTimeToLive
(long ttl, TimeUnit timeUnit) Sets the default Time to Live (TTL) for all cache regions managed by thebuilt
CacheManager
.
-
Constructor Details
-
DefaultCacheManagerBuilder
public DefaultCacheManagerBuilder()
-
-
Method Details
-
withDefaultTimeToLive
Description copied from interface:CacheManagerBuilder
Sets the default Time to Live (TTL) for all cache regions managed by thebuilt
CacheManager
. You may override this default for individual cache regions by using thewithCache
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 interfaceCacheManagerBuilder
- Parameters:
ttl
- default Time To Live scalar valuetimeUnit
- default Time to Live unit of time- Returns:
- the builder instance for method chaining.
-
withDefaultTimeToIdle
Description copied from interface:CacheManagerBuilder
Sets the default Time to Idle (TTI) for all cache regions managed by thebuilt
CacheManager
. You may override this default for individual cache regions by using thewithCache
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 interfaceCacheManagerBuilder
- Parameters:
tti
- default Time To Idle scalar valuetimeUnit
- default Time to Idle unit of time- Returns:
- the builder instance for method chaining.
-
withCache
Description copied from interface:CacheManagerBuilder
Adds configuration settings for a specific Cache region managed by thebuilt
CacheManager
, like the region's Time to Live and Time to Idle.- Specified by:
withCache
in interfaceCacheManagerBuilder
- Parameters:
builder
- the CacheConfigurationBuilder instance that will be used to a cache's configuration.- Returns:
- this instance for method chaining.
-
build
Description copied from interface:CacheManagerBuilder
Returns a newCacheManager
instance reflecting Builder's current configuration.- Specified by:
build
in interfaceCacheManagerBuilder
- Returns:
- a new
CacheManager
instance reflecting Builder's current configuration.
-