Class DefaultCacheManagerBuilder
- All Implemented Interfaces:
CacheManagerBuilder
- Since:
- 0.5.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns a newCacheManagerinstance reflecting Builder's current configuration.withCache(CacheConfigurationBuilder builder) Adds configuration settings for a specific Cache region managed by thebuiltCacheManager, 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 thebuiltCacheManager.withDefaultTimeToLive(long ttl, TimeUnit timeUnit) Sets the default Time to Live (TTL) for all cache regions managed by thebuiltCacheManager.
-
Constructor Details
-
DefaultCacheManagerBuilder
public DefaultCacheManagerBuilder()
-
-
Method Details
-
withDefaultTimeToLive
Description copied from interface:CacheManagerBuilderSets the default Time to Live (TTL) for all cache regions managed by thebuiltCacheManager. You may override this default for individual cache regions by using thewithCachefor 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:
withDefaultTimeToLivein 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:CacheManagerBuilderSets the default Time to Idle (TTI) for all cache regions managed by thebuiltCacheManager. You may override this default for individual cache regions by using thewithCachefor 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:
withDefaultTimeToIdlein 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:CacheManagerBuilderAdds configuration settings for a specific Cache region managed by thebuiltCacheManager, like the region's Time to Live and Time to Idle.- Specified by:
withCachein 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:CacheManagerBuilderReturns a newCacheManagerinstance reflecting Builder's current configuration.- Specified by:
buildin interfaceCacheManagerBuilder- Returns:
- a new
CacheManagerinstance reflecting Builder's current configuration.
-