org.wso2.carbon.caching.impl
Class CacheConfigurationImpl

java.lang.Object
  extended by 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
protected  IsolationLevel isolationLevel
          isolation level
protected  boolean readThrough
          read through
protected  boolean statisticsEnabled
          statistics enabled
protected  boolean storeByValue
          store by value
protected  CacheConfiguration.Duration[] timeToLive
          duration
protected  Mode transactionMode
          transaction mode
protected  boolean writeThrough
          write through
 
Constructor Summary
CacheConfigurationImpl()
           
CacheConfigurationImpl(boolean readThrough, boolean writeThrough, boolean storeByValue, boolean statisticsEnabled, IsolationLevel isolationLevel, Mode transactionMode, CacheConfiguration.Duration[] timeToLive)
           
 
Method Summary
 boolean equals(Object o)
           
 CacheLoader getCacheLoader()
          Gets the registered CacheLoader, if any.
 CacheWriter getCacheWriter()
          Gets the registered CacheWriter, if any.
 CacheConfiguration.Duration getExpiry(CacheConfiguration.ExpiryType type)
          Gets the cache's time to live setting,Sets how long cache entries should live.
 IsolationLevel getTransactionIsolationLevel()
          Gets the transaction isolation level.
 Mode getTransactionMode()
          Gets the transaction mode.
 int hashCode()
           
 boolean isReadThrough()
          Whether the cache is a read-through cache.
 boolean isStatisticsEnabled()
          Checks whether statistics collection is enabled in this cache.
 boolean isStoreByValue()
          Whether storeByValue (true) or storeByReference (false).
 boolean isTransactionEnabled()
          Checks whether transaction are enabled for this cache.
 boolean isWriteThrough()
          Whether the cache is a write-through cache.
 void setStatisticsEnabled(boolean enableStatistics)
          Sets whether statistics gathering is enabled on this cache.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

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 on Cache.get(Object) and Cache#getAll(java.util.Set.

Default value is false.

Specified by:
isReadThrough in interface CacheConfiguration
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:
isWriteThrough in interface CacheConfiguration
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:

Storage by reference only applies to the local heap. If an entry is moved off heap it will need to be transformed into a representation. Any mutations that occur after transformation may not be reflected in the cache.

The default value is true.

When a cache is storeByValue, any mutation to the key or value does not affect the key of value stored in the cache.

Specified by:
isStoreByValue in interface CacheConfiguration
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:
isStatisticsEnabled in interface CacheConfiguration
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:
setStatisticsEnabled in interface CacheConfiguration
Parameters:
enableStatistics - true to enable statistics, false to disable.

getExpiry

public CacheConfiguration.Duration getExpiry(CacheConfiguration.ExpiryType type)
Description copied from interface: CacheConfiguration
Gets the cache's time to live setting,Sets how long cache entries should live. If expiry is not set entries are eternal.

Default value is CacheConfiguration.Duration.ETERNAL.

Specified by:
getExpiry in interface CacheConfiguration
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:
isTransactionEnabled in interface CacheConfiguration
Returns:
true if transaction are enabled

getTransactionIsolationLevel

public IsolationLevel getTransactionIsolationLevel()
Description copied from interface: CacheConfiguration
Gets the transaction isolation level.

Specified by:
getTransactionIsolationLevel in interface CacheConfiguration
Returns:
the isolation level. IsolationLevel.NONE if this cache is not transactional.

getTransactionMode

public Mode getTransactionMode()
Description copied from interface: CacheConfiguration
Gets the transaction mode.

Specified by:
getTransactionMode in interface CacheConfiguration
Returns:
the the mode of the cache. Mode.NONE if this cache is not transactional.

getCacheLoader

public CacheLoader getCacheLoader()
Description copied from interface: CacheConfiguration
Gets the registered CacheLoader, if any.

Specified by:
getCacheLoader in interface CacheConfiguration
Returns:
the CacheLoader or null if none has been set.

getCacheWriter

public CacheWriter getCacheWriter()
Description copied from interface: CacheConfiguration
Gets the registered CacheWriter, if any.

Specified by:
getCacheWriter in interface CacheConfiguration
Returns:
the CacheWriter or null if none has been set.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object


Copyright © 2014 WSO2 Inc. All rights reserved.