javax.cache
Interface CacheConfiguration


public interface CacheConfiguration

Information on how a cache is configured. A Cache may be constructed by CacheManager using a configuration instance. At runtime it is used by javax.cache to decide how to behave. For example the behaviour of put will vary depending on whether the cache is write-through. Finally, a cache makes it's configuration visible via this interface.

Since:
1.0
Author:
Greg Luck, Yannis Cosmadopoulos

Method Summary
 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 transactions are enabled for this cache.
 boolean isWriteThrough()
          Whether the cache is a write-through cache.
 void setReadThrough(boolean readThrough)
          Sets whether the cache is a read-through cache.
 void setStatisticsEnabled(boolean enableStatistics)
          Sets whether statistics gathering is enabled on this cache.
 void setStoreByValue(boolean storeByValue)
          Sets whether the cache is store-by-value cache.
 void setTransactionEnabled(boolean enableTransactions)
          Sets whether transactions are enabled for this cache
 void setWriteThrough(boolean writeThrough)
          Whether the cache is a write-through cache.
 

Method Detail

isReadThrough

boolean isReadThrough()
Whether the cache is a read-through cache. A CacheLoader should be configured for read through caches which is called on a cache miss.

Default value is false.

Returns:
true if the cache is read-through

setReadThrough

void setReadThrough(boolean readThrough)
Sets whether the cache is a read-through cache.

Parameters:
readThrough - the value for readThrough
Throws:
IllegalStateException - if the configuration can no longer be changed

isWriteThrough

boolean isWriteThrough()
Whether the cache is a write-through cache. A CacheWriter should be configured.

Default value is false.

Returns:
true if the cache is write-through

setWriteThrough

void setWriteThrough(boolean writeThrough)
Whether the cache is a write-through cache. A CacheWriter should be configured.

Parameters:
writeThrough - set to true for a write-through cache

isStoreByValue

boolean isStoreByValue()
Whether storeByValue (true) or storeByReference (false). When true both keys and values are stored by value.

Default value is true.

Returns:
true if the cache is store by value

setStoreByValue

void setStoreByValue(boolean storeByValue)
Sets whether the cache is store-by-value cache.

Parameters:
storeByValue - the value for storeByValue
Throws:
IllegalStateException - if the configuration can no longer be changed
InvalidConfigurationException - if the cache does not support store by reference
See Also:
isStoreByValue()

isStatisticsEnabled

boolean isStatisticsEnabled()
Checks whether statistics collection is enabled in this cache.

Default value is false.

Returns:
true if statistics collection is enabled

setStatisticsEnabled

void setStatisticsEnabled(boolean enableStatistics)
Sets whether statistics gathering is enabled on this cache.

Parameters:
enableStatistics - true fo enable statistics, false to disable

isTransactionEnabled

boolean isTransactionEnabled()
Checks whether transactions are enabled for this cache.

Default value is false.

Returns:
true if statistics collection is enabled

setTransactionEnabled

void setTransactionEnabled(boolean enableTransactions)
Sets whether transactions are enabled for this cache

Parameters:
enableTransactions - true fo enable transactions, false to disable


Copyright © 2011. All Rights Reserved.