Class PassThroughCacheConfiguration<K,V>
java.lang.Object
com.tangosol.coherence.jcache.passthroughcache.PassThroughCacheConfiguration<K,V>
- Type Parameters:
K
- the type of theCache
keysV
- the type of theCache
values
- 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
.
Cache
s produced according to this configuration are not expected to be
JCache-compliant. They simply provide a JCache interface (aka: wrapper) over
native Coherence NamedCache
s.
- Since:
- Coherence 12.1.3
- Author:
- bo 2013.10.23
- See Also:
-
Constructor Summary
ConstructorDescriptionConstructs aPassThroughCacheConfiguration
that defaults to using theCache
name as the underlyingNamedCache
name with Object-based key and value types.PassThroughCacheConfiguration
(PassThroughCacheConfiguration<K, V> configuration) Constructs aPassThroughCacheConfiguration
based 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 aCoherenceBasedCache
based on the current state of theCoherenceBasedConfiguration
, to be owned by the specifiedCoherenceBasedCacheManager
.void
destroyCache
(CoherenceBasedCacheManager manager, String name) Destroy aCoherenceBasedCache
implementation.Obtains the desired mapping of a JCacheCache
name to an CoherenceNamedCache
.boolean
setNamedCacheName
(String sNamedCacheName) Sets the desired CoherenceNamedCache
name to map to when specifying a JCacheCache
nameSets the expected type of keys and values for aPassThroughCache
configured with thisConfiguration
.
-
Constructor Details
-
PassThroughCacheConfiguration
public PassThroughCacheConfiguration()Constructs aPassThroughCacheConfiguration
that defaults to using theCache
name as the underlyingNamedCache
name 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
CompleteConfiguration
properties 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 aPassThroughCacheConfiguration
based on a providedPassThroughCacheConfiguration
.- Parameters:
configuration
- thePassThroughCacheConfiguration
-
-
Method Details
-
setNamedCacheName
Sets the desired CoherenceNamedCache
name to map to when specifying a JCacheCache
name- Parameters:
sNamedCacheName
- the desiredNamedCache
(ornull
to default to the JCache name)- Returns:
- the
PassThroughCacheConfiguration
to support fluent-style calls
-
getNamedCacheName
Obtains the desired mapping of a JCacheCache
name to an CoherenceNamedCache
.- Returns:
- the
NamedCache
name to use
-
setTypes
Sets the expected type of keys and values for aPassThroughCache
configured with thisConfiguration
. Setting both toObject.class
means type-safety checks are not required (which is the default)- Parameters:
clzKey
- the expected key typeclzValue
- the expected value type- Returns:
- the
PassThroughCacheConfiguration
to 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:CoherenceBasedConfiguration
Creates aCoherenceBasedCache
based on the current state of theCoherenceBasedConfiguration
, to be owned by the specifiedCoherenceBasedCacheManager
.- Specified by:
createCache
in interfaceCoherenceBasedConfiguration<K,
V> - Parameters:
manager
- the owningCoherenceBasedCacheManager
sJCacheName
- the name of theCache
to be configured- Returns:
- a
CoherenceBasedCache
- Throws:
IllegalArgumentException
- when aCache
can't be created based on the currentCoherenceBasedConfiguration
-
destroyCache
Description copied from interface:CoherenceBasedConfiguration
Destroy aCoherenceBasedCache
implementation.- Specified by:
destroyCache
in interfaceCoherenceBasedConfiguration<K,
V> - Parameters:
manager
- the owningCoherenceBasedCacheManager
name
- the name of theCache
to be destroyed
-