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>
A
Configuration for a
Cache based on an existing Coherence
NamedCache.
Caches produced according to this configuration are not expected to be
JCache-compliant. They simply provide a JCache interface (aka: wrapper) over
native Coherence NamedCaches.
- Since:
- Coherence 12.1.3
- Author:
- bo 2013.10.23
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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
Modifier and TypeMethodDescriptioncreateCache(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.Obtains the desired mapping of a JCacheCachename to an CoherenceNamedCache.booleansetNamedCacheName(String sNamedCacheName) Sets the desired CoherenceNamedCachename to map to when specifying a JCacheCachenameSets the expected type of keys and values for aPassThroughCacheconfigured with thisConfiguration.
-
Constructor Details
-
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
Constructs aPassThroughCacheConfigurationbased on a providedPassThroughCacheConfiguration.- Parameters:
configuration- thePassThroughCacheConfiguration
-
-
Method Details
-
setNamedCacheName
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
Obtains the desired mapping of a JCacheCachename to an CoherenceNamedCache.- Returns:
- the
NamedCachename to use
-
setTypes
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
-
getKeyType
-
getValueType
-
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
Description copied from interface:CoherenceBasedConfigurationDestroy aCoherenceBasedCacheimplementation.- Specified by:
destroyCachein interfaceCoherenceBasedConfiguration<K,V> - Parameters:
manager- the owningCoherenceBasedCacheManagername- the name of theCacheto be destroyed
-