Package org.wso2.carbon.caching.impl
Class CacheConfigurationImpl
- java.lang.Object
-
- org.wso2.carbon.caching.impl.CacheConfigurationImpl
-
- All Implemented Interfaces:
CacheConfiguration
public final class CacheConfigurationImpl extends Object implements CacheConfiguration
TODO: class description
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface javax.cache.CacheConfiguration
CacheConfiguration.Duration, CacheConfiguration.ExpiryType
-
-
Field Summary
Fields Modifier and Type Field Description protected IsolationLevelisolationLevelisolation levelprotected booleanreadThroughread throughprotected booleanstatisticsEnabledstatistics enabledprotected booleanstoreByValuestore by valueprotected CacheConfiguration.Duration[]timeToLivedurationprotected ModetransactionModetransaction modeprotected booleanwriteThroughwrite through
-
Constructor Summary
Constructors Constructor Description CacheConfigurationImpl()CacheConfigurationImpl(boolean readThrough, boolean writeThrough, boolean storeByValue, boolean statisticsEnabled, IsolationLevel isolationLevel, Mode transactionMode, CacheConfiguration.Duration[] timeToLive)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)CacheLoadergetCacheLoader()Gets the registeredCacheLoader, if any.CacheWritergetCacheWriter()Gets the registeredCacheWriter, if any.CacheConfiguration.DurationgetExpiry(CacheConfiguration.ExpiryType type)Gets the cache's time to live setting,Sets how long cache entries should live.IsolationLevelgetTransactionIsolationLevel()Gets the transaction isolation level.ModegetTransactionMode()Gets the transaction mode.inthashCode()booleanisReadThrough()Whether the cache is a read-through cache.booleanisStatisticsEnabled()Checks whether statistics collection is enabled in this cache.booleanisStoreByValue()Whether storeByValue (true) or storeByReference (false).booleanisTransactionEnabled()Checks whether transaction are enabled for this cache.booleanisWriteThrough()Whether the cache is a write-through cache.voidsetStatisticsEnabled(boolean enableStatistics)Sets whether statistics gathering is enabled on this cache.
-
-
-
Field Detail
-
readThrough
protected boolean readThrough
read through
-
writeThrough
protected boolean writeThrough
write through
-
statisticsEnabled
protected boolean statisticsEnabled
statistics enabled
-
timeToLive
protected CacheConfiguration.Duration[] timeToLive
duration
-
storeByValue
protected boolean storeByValue
store by value
-
isolationLevel
protected IsolationLevel isolationLevel
isolation level
-
transactionMode
protected Mode transactionMode
transaction mode
-
-
Constructor Detail
-
CacheConfigurationImpl
public CacheConfigurationImpl()
-
CacheConfigurationImpl
public CacheConfigurationImpl(boolean readThrough, boolean writeThrough, boolean storeByValue, boolean statisticsEnabled, IsolationLevel isolationLevel, Mode transactionMode, CacheConfiguration.Duration[] timeToLive)
-
-
Method Detail
-
isReadThrough
public boolean isReadThrough()
Whether the cache is a read-through cache. A CacheLoader should be configured for read through caches which is called by the cache for what without the loader would have been misses onCache.get(Object)and {@link Cache#getAll(java.util.Set}. Default value is false.- Specified by:
isReadThroughin interfaceCacheConfiguration- Returns:
- true if the cache is read-through
-
isWriteThrough
public boolean isWriteThrough()
Whether the cache is a write-through cache. If so a CacheWriter should be configured. Default value is false.- Specified by:
isWriteThroughin interfaceCacheConfiguration- Returns:
- true if the cache is write-through
-
isStoreByValue
public boolean isStoreByValue()
Whether storeByValue (true) or storeByReference (false). When true, both keys and values are stored by value. When false, both keys and values are stored by reference. Caches stored by reference are capable of mutation by any threads holding the reference. The effects are:- if the key is mutated, then the key may not be retrievable or removable
- if the value is mutated, then all threads in the JVM can potentially observe those mutations, subject to the normal Java Memory Model rules.
- Specified by:
isStoreByValuein interfaceCacheConfiguration- Returns:
- true if the cache is store by value
-
isStatisticsEnabled
public boolean isStatisticsEnabled()
Checks whether statistics collection is enabled in this cache. The default value is false.- Specified by:
isStatisticsEnabledin interfaceCacheConfiguration- Returns:
- true if statistics collection is enabled
-
setStatisticsEnabled
public void setStatisticsEnabled(boolean enableStatistics)
Sets whether statistics gathering is enabled on this cache. This may be changed at runtime.- Specified by:
setStatisticsEnabledin interfaceCacheConfiguration- Parameters:
enableStatistics- true to enable statistics, false to disable.
-
getExpiry
public CacheConfiguration.Duration getExpiry(CacheConfiguration.ExpiryType type)
Description copied from interface:CacheConfigurationGets the cache's time to live setting,Sets how long cache entries should live. If expiry is not set entries are eternal. Default value isCacheConfiguration.Duration.ETERNAL.- Specified by:
getExpiryin interfaceCacheConfiguration- Parameters:
type- the type of the expiration- Returns:
- how long, in milliseconds, the specified units, the entry should live. 0 means eternal.
-
isTransactionEnabled
public boolean isTransactionEnabled()
Checks whether transaction are enabled for this cache. Default value is false.- Specified by:
isTransactionEnabledin interfaceCacheConfiguration- Returns:
- true if transaction are enabled
-
getTransactionIsolationLevel
public IsolationLevel getTransactionIsolationLevel()
Description copied from interface:CacheConfigurationGets the transaction isolation level.- Specified by:
getTransactionIsolationLevelin interfaceCacheConfiguration- Returns:
- the isolation level.
IsolationLevel.NONEif this cache is not transactional.
-
getTransactionMode
public Mode getTransactionMode()
Description copied from interface:CacheConfigurationGets the transaction mode.- Specified by:
getTransactionModein interfaceCacheConfiguration- Returns:
- the the mode of the cache.
Mode.NONEif this cache is not transactional.
-
getCacheLoader
public CacheLoader getCacheLoader()
Description copied from interface:CacheConfigurationGets the registeredCacheLoader, if any.- Specified by:
getCacheLoaderin interfaceCacheConfiguration- Returns:
- the
CacheLoaderor null if none has been set.
-
getCacheWriter
public CacheWriter getCacheWriter()
Description copied from interface:CacheConfigurationGets the registeredCacheWriter, if any.- Specified by:
getCacheWriterin interfaceCacheConfiguration- Returns:
- the
CacheWriteror null if none has been set.
-
-