Package javax.cache.configuration
Interface Configuration<K,V>
-
- Type Parameters:
K
- the type of keys maintained the cacheV
- the type of cached values
- All Superinterfaces:
java.io.Serializable
- All Known Subinterfaces:
CompleteConfiguration<K,V>
- All Known Implementing Classes:
MutableConfiguration
public interface Configuration<K,V> extends java.io.Serializable
A basic read-only representation of aCache
configuration.The properties provided by instances of this interface are used by
CacheManager
s to configureCache
s.Implementations of this interface must override
Object.hashCode()
andObject.equals(Object)
asConfiguration
s are often compared at runtime.- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Class<K>
getKeyType()
Determines the required type of keys forCache
s configured with thisConfiguration
.java.lang.Class<V>
getValueType()
Determines the required type of values forCache
s configured with thisConfiguration
.boolean
isStoreByValue()
Whether storeByValue (true) or storeByReference (false).
-
-
-
Method Detail
-
getKeyType
java.lang.Class<K> getKeyType()
Determines the required type of keys forCache
s configured with thisConfiguration
.- Returns:
- the key type or
Object.class
if the type is undefined
-
getValueType
java.lang.Class<V> getValueType()
Determines the required type of values forCache
s configured with thisConfiguration
.- Returns:
- the value type or
Object.class
if the type is undefined
-
isStoreByValue
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.
When a cache is storeByValue, any mutation to the key or value does not affect the key of value stored in the cache.
The default value is
true
.- Returns:
- true if the cache is store by value
-
-