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.7
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 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 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).

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
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


Copyright © 2011. All Rights Reserved.