Package org.wso2.carbon.caching.impl
Class CacheBuilderImpl<K,V>
java.lang.Object
org.wso2.carbon.caching.impl.CacheBuilderImpl<K,V>
- All Implemented Interfaces:
CacheBuilder<K,V>
TODO: class description
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Create an instance of the namedCache.registerCacheEntryListener(CacheEntryListener<K, V> cacheEntryListener) Registers a listener.setCacheLoader(CacheLoader<K, ? extends V> cacheLoader) Sets the cache loader.setCacheWriter(CacheWriter<? super K, ? super V> cacheWriter) Sets the cache writer.setExpiry(CacheConfiguration.ExpiryType type, CacheConfiguration.Duration duration) Sets the cache expirationsetReadThrough(boolean readThrough) Sets whether the cache is a read-through cache.setStatisticsEnabled(boolean enableStatistics) Sets whether statistics gathering is enabled on this cache.setStoreByValue(boolean storeByValue) Sets whether the cache is store-by-value cache.setTransactionEnabled(IsolationLevel isolationLevel, Mode mode) Sets whether transaction are enabled for this cache.setWriteThrough(boolean writeThrough) Whether the cache is a write-through cache.
-
Constructor Details
-
CacheBuilderImpl
-
-
Method Details
-
build
Description copied from interface:CacheBuilderCreate an instance of the namedCache. 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.- Specified by:
buildin interfaceCacheBuilder<K,V> - Returns:
- a new instance of the named cache
- See Also:
-
setCacheLoader
Description copied from interface:CacheBuilderSets the cache loader.- Specified by:
setCacheLoaderin interfaceCacheBuilder<K,V> - Parameters:
cacheLoader- the CacheLoader- Returns:
- the builder
-
setCacheWriter
Description copied from interface:CacheBuilderSets the cache writer.- Specified by:
setCacheWriterin interfaceCacheBuilder<K,V> - Parameters:
cacheWriter- the CacheWriter- Returns:
- the builder
-
registerCacheEntryListener
Description copied from interface:CacheBuilderRegisters a listener. Can be invoked multiple times.- Specified by:
registerCacheEntryListenerin interfaceCacheBuilder<K,V> - Parameters:
cacheEntryListener- the listener- Returns:
- the builder
-
setStoreByValue
Description copied from interface:CacheBuilderSets whether the cache is store-by-value cache.- Specified by:
setStoreByValuein interfaceCacheBuilder<K,V> - Parameters:
storeByValue- the value for storeByValue- Returns:
- the builder
- See Also:
-
setTransactionEnabled
Description copied from interface:CacheBuilderSets whether transaction are enabled for this cache.- Specified by:
setTransactionEnabledin interfaceCacheBuilder<K,V> - Parameters:
isolationLevel- - the isolation level for this cachemode- - the mode (Local or XA) for this cache- Returns:
- the builder
- See Also:
-
setStatisticsEnabled
Description copied from interface:CacheBuilderSets whether statistics gathering is enabled on this cache.- Specified by:
setStatisticsEnabledin interfaceCacheBuilder<K,V> - Parameters:
enableStatistics- true to enable statistics, false to disable- Returns:
- the builder
- See Also:
-
setReadThrough
Description copied from interface:CacheBuilderSets whether the cache is a read-through cache. If so a CacheLoader should be configured.- Specified by:
setReadThroughin interfaceCacheBuilder<K,V> - Parameters:
readThrough- the value for readThrough- Returns:
- the builder
-
setWriteThrough
Description copied from interface:CacheBuilderWhether the cache is a write-through cache. A CacheWriter should be configured.- Specified by:
setWriteThroughin interfaceCacheBuilder<K,V> - Parameters:
writeThrough- set to true for a write-through cache- Returns:
- the builder
-
setExpiry
public CacheBuilder<K,V> setExpiry(CacheConfiguration.ExpiryType type, CacheConfiguration.Duration duration) Description copied from interface:CacheBuilderSets the cache expiration- Specified by:
setExpiryin interfaceCacheBuilder<K,V> - Parameters:
type- whether based on creation/modification or last access timeduration- the amount of time- Returns:
- the builder
-