Class CoherenceCacheConfiguration
java.lang.Object
com.oracle.coherence.spring.cache.CoherenceCacheConfiguration
Defines additional configuration properties for the 
CoherenceCache. Can also serve as default cache configuration
 via CoherenceCacheManager.- Since:
- 3.0
- Author:
- Gunnar Hillert
- 
Constructor SummaryConstructorsConstructorDescriptionThe default constructor.CoherenceCacheConfiguration(Duration timeToLive) Initialize the cache configuration properties.
- 
Method SummaryModifier and TypeMethodDescriptiongetCacheName(String name) Return the full cache name for the provided base cache name.The String to prepend cache names with.longReturns the number of milliseconds to continue trying to obtain a lock.Returns the expiration time for cache entries.booleanIf returning true, this property will lock the entire cache.booleanThis property is false by default.booleanIf true, cache entries will be locked for concurrency control.voidsetCacheNamePrefix(String cacheNamePrefix) Set the String to prepend the cache name with.voidsetLockEntireCache(boolean lockEntireCache) If setting to true, this property will lock the entire cache.voidsetLockTimeout(long lockTimeout) Will set the lock timeout in milliseconds.voidsetTimeToLive(Duration timeToLive) Sets the expiration time for cache entries.voidsetUseCacheNamePrefix(boolean useCacheNamePrefix) This property is false by default.voidsetUseLocks(boolean useLocks) If true, cache entries will be locked for concurrency control.
- 
Constructor Details- 
CoherenceCacheConfigurationpublic CoherenceCacheConfiguration()The default constructor.
- 
CoherenceCacheConfigurationInitialize the cache configuration properties.- Parameters:
- timeToLive- the expiration time for cache entries. Set this property to- Duration.ZEROto control the expiration via the coherence-cache-config.xml file. A value of -1 milliseconds will cause cache entries not to expire.
 
 
- 
- 
Method Details- 
getTimeToLiveReturns the expiration time for cache entries. Should never be null. A value of zero milliseconds means that the cache's default expiration value shall be used, e.g. to control the expiration via the coherence-cache-config.xml file. A value of -1 milliseconds means that the cache value will never expire.- Returns:
- the time-to-live (TTL) for cache entries. Defaults to Duration.ZERO.
 
- 
setTimeToLiveSets the expiration time for cache entries. If not set, it will default toDuration.ZERO.- Parameters:
- timeToLive- must neither be null nor smaller than -1 milliseconds.
 
- 
isUseCacheNamePrefixpublic boolean isUseCacheNamePrefix()This property is false by default. If true, the cache name will be prefixed with the name specified bygetCacheName(String).- Returns:
- true if the getCacheNamePrefix()is to be used
 
- 
setUseCacheNamePrefixpublic void setUseCacheNamePrefix(boolean useCacheNamePrefix) This property is false by default. If set to true, the cache name will be prefixed with the name specified bygetCacheName(String).- Parameters:
- useCacheNamePrefix- shall a cache name prefix be used? If not specified, this property defaults to false.
 
- 
getCacheNamePrefixThe String to prepend cache names with. Empty by default. Will be ignored ifisUseCacheNamePrefix()is false.- Returns:
- the cache name prefix
 
- 
setCacheNamePrefixSet the String to prepend the cache name with. If not set will default to an empty String.- Parameters:
- cacheNamePrefix- the cache name prefix
 
- 
getCacheNameReturn the full cache name for the provided base cache name. IfisUseCacheNamePrefix()returns true, the cache name will be prepended bygetCacheNamePrefix().- Parameters:
- name- must not be null or empty
- Returns:
- the full cache name including prefix if enabled
 
- 
isUseLockspublic boolean isUseLocks()If true, cache entries will be locked for concurrency control. This property returns true by default. When using Coherence*Extend or gRPC, it is recommended to not use locking. This property is used by the value-loader inCoherenceCache.get(Object, Callable).- Returns:
- if not set, will return true
 
- 
setUseLockspublic void setUseLocks(boolean useLocks) If true, cache entries will be locked for concurrency control. This property is set to true by default. When using Coherence*Extend or gRPC, it is recommended to set this property to false.- Parameters:
- useLocks- if not set will default to true
 
- 
isLockEntireCachepublic boolean isLockEntireCache()If returning true, this property will lock the entire cache. This is usually not recommended.- Returns:
- true if the entire cache shall be locked. This property is used by the value-loader in
 CoherenceCache.get(Object, Callable).
 
- 
setLockEntireCachepublic void setLockEntireCache(boolean lockEntireCache) If setting to true, this property will lock the entire cache. This is usually not recommended.- Parameters:
- lockEntireCache- if not set defaults to false
 
- 
getLockTimeoutpublic long getLockTimeout()Returns the number of milliseconds to continue trying to obtain a lock. If zero is returned, the lock attempt will return immediately. A value of -1 means that the underlying locking operation will block indefinitely until the lock could be obtained. Defaults to 0. This property is used by the value-loader inCoherenceCache.get(Object, Callable).- Returns:
- the lock timeout in milliseconds
 
- 
setLockTimeoutpublic void setLockTimeout(long lockTimeout) Will set the lock timeout in milliseconds. If set to zero is returned, the lock attempt will return immediately. A value of -1 means that the underlying locking operation will block indefinitely until the lock could be obtained. If not set, this property defaults to 0.- Parameters:
- lockTimeout- the lock timeout in milliseconds
 
 
-