Class PassThroughCacheConfiguration<K,V>
- java.lang.Object
-
- com.tangosol.coherence.jcache.passthroughcache.PassThroughCacheConfiguration<K,V>
-
- Type Parameters:
K- the type of theCachekeysV- the type of theCachevalues
- All Implemented Interfaces:
CoherenceBasedConfiguration<K,V>,Serializable,javax.cache.configuration.Configuration<K,V>
public class PassThroughCacheConfiguration<K,V> extends Object implements CoherenceBasedConfiguration<K,V>
AConfigurationfor aCachebased on an existing CoherenceNamedCache.Caches produced according to this configuration are not expected to be JCache-compliant. They simply provide a JCache interface (aka: wrapper) over native CoherenceNamedCaches.- Since:
- Coherence 12.1.3
- Author:
- bo 2013.10.23
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PassThroughCacheConfiguration()Constructs aPassThroughCacheConfigurationthat defaults to using theCachename as the underlyingNamedCachename with Object-based key and value types.PassThroughCacheConfiguration(PassThroughCacheConfiguration<K,V> configuration)Constructs aPassThroughCacheConfigurationbased on a providedPassThroughCacheConfiguration.PassThroughCacheConfiguration(javax.cache.configuration.CompleteConfiguration<K,V> configuration)Constructs a PassThroughConfiguration based on a JCacheCompleteConfiguration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CoherenceBasedCache<K,V>createCache(CoherenceBasedCacheManager manager, String sJCacheName)Creates aCoherenceBasedCachebased on the current state of theCoherenceBasedConfiguration, to be owned by the specifiedCoherenceBasedCacheManager.voiddestroyCache(CoherenceBasedCacheManager manager, String name)Destroy aCoherenceBasedCacheimplementation.Class<K>getKeyType()StringgetNamedCacheName()Obtains the desired mapping of a JCacheCachename to an CoherenceNamedCache.Class<V>getValueType()booleanisStoreByValue()PassThroughCacheConfiguration<K,V>setNamedCacheName(String sNamedCacheName)Sets the desired CoherenceNamedCachename to map to when specifying a JCacheCachenamePassThroughCacheConfiguration<K,V>setTypes(Class<K> clzKey, Class<V> clzValue)Sets the expected type of keys and values for aPassThroughCacheconfigured with thisConfiguration.
-
-
-
Constructor Detail
-
PassThroughCacheConfiguration
public PassThroughCacheConfiguration()
Constructs aPassThroughCacheConfigurationthat defaults to using theCachename as the underlyingNamedCachename with Object-based key and value types.
-
PassThroughCacheConfiguration
public PassThroughCacheConfiguration(javax.cache.configuration.CompleteConfiguration<K,V> configuration)
Constructs a PassThroughConfiguration based on a JCacheCompleteConfiguration.WARNING: This is a lossy construction and a warning will be emitted when this method is called. Most
CompleteConfigurationproperties are ignored. Native Coherence configuration must be used when usingPassThroughCache;- Parameters:
configuration- configuration properties of a JCacheCompleteConfiguration. Note most of these properties are ignored.
-
PassThroughCacheConfiguration
public PassThroughCacheConfiguration(PassThroughCacheConfiguration<K,V> configuration)
Constructs aPassThroughCacheConfigurationbased on a providedPassThroughCacheConfiguration.- Parameters:
configuration- thePassThroughCacheConfiguration
-
-
Method Detail
-
setNamedCacheName
public PassThroughCacheConfiguration<K,V> setNamedCacheName(String sNamedCacheName)
Sets the desired CoherenceNamedCachename to map to when specifying a JCacheCachename- Parameters:
sNamedCacheName- the desiredNamedCache(ornullto default to the JCache name)- Returns:
- the
PassThroughCacheConfigurationto support fluent-style calls
-
getNamedCacheName
public String getNamedCacheName()
Obtains the desired mapping of a JCacheCachename to an CoherenceNamedCache.- Returns:
- the
NamedCachename to use
-
setTypes
public PassThroughCacheConfiguration<K,V> setTypes(Class<K> clzKey, Class<V> clzValue)
Sets the expected type of keys and values for aPassThroughCacheconfigured with thisConfiguration. Setting both toObject.classmeans type-safety checks are not required (which is the default)- Parameters:
clzKey- the expected key typeclzValue- the expected value type- Returns:
- the
PassThroughCacheConfigurationto permit fluent-style method calls - Throws:
NullPointerException- should the key or value type be null
-
isStoreByValue
public boolean isStoreByValue()
-
createCache
public CoherenceBasedCache<K,V> createCache(CoherenceBasedCacheManager manager, String sJCacheName) throws IllegalArgumentException
Description copied from interface:CoherenceBasedConfigurationCreates aCoherenceBasedCachebased on the current state of theCoherenceBasedConfiguration, to be owned by the specifiedCoherenceBasedCacheManager.- Specified by:
createCachein interfaceCoherenceBasedConfiguration<K,V>- Parameters:
manager- the owningCoherenceBasedCacheManagersJCacheName- the name of theCacheto be configured- Returns:
- a
CoherenceBasedCache - Throws:
IllegalArgumentException- when aCachecan't be created based on the currentCoherenceBasedConfiguration
-
destroyCache
public void destroyCache(CoherenceBasedCacheManager manager, String name)
Description copied from interface:CoherenceBasedConfigurationDestroy aCoherenceBasedCacheimplementation.- Specified by:
destroyCachein interfaceCoherenceBasedConfiguration<K,V>- Parameters:
manager- the owningCoherenceBasedCacheManagername- the name of theCacheto be destroyed
-
-