|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
K
- the key typeV
- the value typepublic interface CacheBuilder<K,V>
A CacheBuilder is used for creating Caches.
A CacheBuilder is created by CacheManager.createCacheBuilder(String)
and is associated with that
manager.
Additional configuration methods may be available on a builder instance by casting to a concrete implementation.
Method Summary | |
---|---|
Cache<K,V> |
build()
Create an instance of the named Cache . |
CacheBuilder<K,V> |
registerCacheEntryListener(CacheEntryListener<K,V> cacheEntryListener,
NotificationScope scope,
boolean synchronous)
Registers a listener. |
CacheBuilder<K,V> |
setCacheLoader(CacheLoader<K,V> cacheLoader)
Sets the cache loader. |
CacheBuilder<K,V> |
setCacheWriter(CacheWriter<K,V> cacheWriter)
Sets the cache writer. |
CacheBuilder<K,V> |
setExpiry(CacheConfiguration.ExpiryType type,
CacheConfiguration.Duration duration)
Sets the cache expiration |
CacheBuilder<K,V> |
setReadThrough(boolean readThrough)
Sets whether the cache is a read-through cache. |
CacheBuilder<K,V> |
setStatisticsEnabled(boolean enableStatistics)
Sets whether statistics gathering is enabled on this cache. |
CacheBuilder<K,V> |
setStoreByValue(boolean storeByValue)
Sets whether the cache is store-by-value cache. |
CacheBuilder<K,V> |
setTransactionEnabled(IsolationLevel isolationLevel,
Mode mode)
Sets whether transaction are enabled for this cache. |
CacheBuilder<K,V> |
setWriteThrough(boolean writeThrough)
Whether the cache is a write-through cache. |
Method Detail |
---|
Cache<K,V> build()
Cache
.
The Cache will be created, added to the caches controlled by its associated CacheManager and started.
If there is an existing Cache of the same name associated with this CacheManager when build is invoked,
the old Cache will be stopped.
InvalidConfigurationException
- thrown if the configuration is invalid. Examples include if
read through has been set to true but no cache loader is specified, or if no cache writer is specified but
write through has been set.
CacheException
- if a cache with that name already exists or there was an error adding the cache to the CacheManagerCacheManager.createCacheBuilder(String)
CacheBuilder<K,V> setCacheLoader(CacheLoader<K,V> cacheLoader)
cacheLoader
- the CacheLoader
NullPointerException
- if cacheLoader is null.CacheBuilder<K,V> setCacheWriter(CacheWriter<K,V> cacheWriter)
cacheWriter
- the CacheWriter
NullPointerException
- if cacheWriter is null.CacheBuilder<K,V> registerCacheEntryListener(CacheEntryListener<K,V> cacheEntryListener, NotificationScope scope, boolean synchronous)
cacheEntryListener
- the listenerscope
- the notification scope.synchronous
- whether to listener should be invoked synchronously
NullPointerException
- if any of the arguments are null.CacheBuilder<K,V> setStoreByValue(boolean storeByValue)
storeByValue
- the value for storeByValue
IllegalStateException
- if the configuration can no longer be changed
InvalidConfigurationException
- if the cache does not support store by referenceCacheConfiguration.isStoreByValue()
CacheBuilder<K,V> setTransactionEnabled(IsolationLevel isolationLevel, Mode mode)
isolationLevel
- - the isolation level for this cachemode
- - the mode (Local or XA) for this cache
InvalidConfigurationException
- if the cache does not support transactions, or the isolation level IsolationLevel.NONE
CacheConfiguration.isTransactionEnabled()
CacheBuilder<K,V> setStatisticsEnabled(boolean enableStatistics)
enableStatistics
- true to enable statistics, false to disable
CacheConfiguration.setStatisticsEnabled(boolean)
CacheBuilder<K,V> setReadThrough(boolean readThrough)
readThrough
- the value for readThrough
CacheBuilder<K,V> setWriteThrough(boolean writeThrough)
writeThrough
- set to true for a write-through cache
CacheBuilder<K,V> setExpiry(CacheConfiguration.ExpiryType type, CacheConfiguration.Duration duration)
type
- whether based on creation/modification or last access timeduration
- the amount of time
NullPointerException
- if size is duration
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |