Package org.wso2.carbon.caching.impl
Class CacheConfigurationImpl
java.lang.Object
org.wso2.carbon.caching.impl.CacheConfigurationImpl
- All Implemented Interfaces:
CacheConfiguration
TODO: class description
-
Nested Class Summary
Nested classes/interfaces inherited from interface javax.cache.CacheConfiguration
CacheConfiguration.Duration, CacheConfiguration.ExpiryType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IsolationLevelisolation levelprotected booleanread throughprotected booleanstatistics enabledprotected booleanstore by valueprotected CacheConfiguration.Duration[]durationprotected Modetransaction modeprotected booleanwrite through -
Constructor Summary
ConstructorsConstructorDescriptionCacheConfigurationImpl(boolean readThrough, boolean writeThrough, boolean storeByValue, boolean statisticsEnabled, IsolationLevel isolationLevel, Mode transactionMode, CacheConfiguration.Duration[] timeToLive) -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the registeredCacheLoader, if any.Gets the registeredCacheWriter, if any.Gets the cache's time to live setting,Sets how long cache entries should live.Gets the transaction isolation level.Gets the transaction mode.inthashCode()booleanWhether the cache is a read-through cache.booleanChecks whether statistics collection is enabled in this cache.booleanWhether storeByValue (true) or storeByReference (false).booleanChecks whether transaction are enabled for this cache.booleanWhether the cache is a write-through cache.voidsetStatisticsEnabled(boolean enableStatistics) Sets whether statistics gathering is enabled on this cache.
-
Field Details
-
readThrough
protected boolean readThroughread through -
writeThrough
protected boolean writeThroughwrite through -
statisticsEnabled
protected boolean statisticsEnabledstatistics enabled -
timeToLive
duration -
storeByValue
protected boolean storeByValuestore by value -
isolationLevel
isolation level -
transactionMode
transaction mode
-
-
Constructor Details
-
CacheConfigurationImpl
public CacheConfigurationImpl() -
CacheConfigurationImpl
public CacheConfigurationImpl(boolean readThrough, boolean writeThrough, boolean storeByValue, boolean statisticsEnabled, IsolationLevel isolationLevel, Mode transactionMode, CacheConfiguration.Duration[] timeToLive)
-
-
Method Details
-
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}. Default value is false.invalid @link
{@link Cache#getAll(java.util.Set- 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
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
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
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
Description copied from interface:CacheConfigurationGets the registeredCacheLoader, if any.- Specified by:
getCacheLoaderin interfaceCacheConfiguration- Returns:
- the
CacheLoaderor null if none has been set.
-
getCacheWriter
Description copied from interface:CacheConfigurationGets the registeredCacheWriter, if any.- Specified by:
getCacheWriterin interfaceCacheConfiguration- Returns:
- the
CacheWriteror null if none has been set.
-
hashCode
public int hashCode() -
equals
-